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@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@oxygenxml.com
http://www.oxygenxml.com/mailman/listinfo/oxygen-user