adfa.ad.asdf.efa.saf mark

I need to match the saf mark, no more no less ahead.

I find that if I use this,


It matches all along to the first .. Any suggestions? Thanks.


If you make your collection negative, it should do what you want: /[^,.;]*mark

| improve this answer | |

To my knowledge when there is a race between two goals (in this case "find the first match for the expression" vs. "find the match with the least characters"), the first goal wins.

So depending on what matches you need for which lines (always the part after the last punctuation before the mark?) you could move the greedy part in front:


Again, the first goal wins, so the second * only gets what the first one leaves

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.