[oXygen-user] How to match across multiple lines using regex?
Oxygen XML Editor Support
support at oxygenxml.com
Wed Jan 15 08:24:18 CST 2014
Hi Eliot,
The ? operator makes it a lazy match (first best match) instead of a
greedy match (longest possible match).
Without the ? operator the expression is greedy and will match a lot
more content than expected.
You can use either (.|\n)*? or .*? with "dot matches all", but in either
case the ? operator is the one that limits the search to the first best
match.
Regards,
Adrian
Adrian Buza
oXygen XML Editor and Author Support
Tel: +1-650-352-1250 ext.202
Fax: +40-251-461482
support at oxygenxml.com
http://www.oxygenxml.com
On 11.01.2014 23:24, Eliot Kimber wrote:
> That works. But here's another question: why is the outer group with the ?
> operator required? I tried just (.|\n)*, which should match anything
> between my start and end strings, but it does not, where ((.|\n)*?) does.
>
> Thanks,
>
> E.
>
>
> _______________________________________________
> oXygen-user mailing list
> oXygen-user at oxygenxml.com
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20140115/629562b4/attachment.html
More information about the oXygen-user
mailing list