3

"1 cup of Greek or natural yoghurt."

I want cup to be filtered out.

"1gm of salt."

Here i want gm to be extracted.

I want a regex expression which is the combination of both.

Any help would be appriciated.

Alan Moore
  • 73,866
  • 12
  • 100
  • 156
user1068810
  • 387
  • 2
  • 6
  • 14

1 Answers1

1
/^(.+?)( cup|gm)(.+?)$/i

replace to

\1 \3

regex101

l00k
  • 1,525
  • 1
  • 19
  • 29