2
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,

/\v[,.;]\zs.{-}mark

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

4

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

2

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:

/.*[,.;]\zs.*mark

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

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.