Extract word or character after matched string excluding whiteSpace and matched string using regex

| | August 7, 2015

“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.

One Response to “Extract word or character after matched string excluding whiteSpace and matched string using regex”

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

    replace to

    1 3
    

    regex101

Leave a Reply