Copy link to clipboard
Copied
I'm trying to create a grep string that will subscript a symbol but only after specific words and not all instances of the symbol.
In the example below I want the % subscripted when used after Melon and Apple but no other use of % should be subscripted.
I cant figure out what I'm doing wrong?
(?<=[Grape|Orange|Apple|Bananna|Avocado|Melon|Pineapple])%
Robert,
Bad answer! …
Right Grep syntax:
(Grape|Orange|Apple|Bananna|Avocado|Melon|Pineapple)\K%
(?<= …) just doesn't work with such a variable list!
(^/) The Jedi
Copy link to clipboard
Copied
[] is for any Character from the list - you should rather use () instead.
Copy link to clipboard
Copied
Robert,
Bad answer! …
Right Grep syntax:
(Grape|Orange|Apple|Bananna|Avocado|Melon|Pineapple)\K%
(?<= …) just doesn't work with such a variable list!
(^/) The Jedi
Copy link to clipboard
Copied
Oooh I have not used \K ... thank you!!!