Reply To: GREP expression help

#62632
angeldesigner34
Participant

Jongware said:

GREP is “greedy” by default, and it will try to grab as much as it can, while still doing exactly what you asked for. So in your multiple-refs case, it exactly does as told: start with 'ref”, then some unspecified other stuff, then end at (the very last) closing parens.

Fortunately, you can switch this off and tell GREP to use the shortest possible match:

(ref..+?)

(Note that I inserted the — probably — missing backslashes ;) The forum software removes single s, so to get you must type ).

There is no need, by the way, for your construction

[.].+

to force a “literal” full stop. Just add a single backslah before it to make it loose its magic properties.



This article was last modified on July 18, 2012

Comments (0)

Loading comments...