lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 03/03/2014 19.34, Andrew Starks wrote:
Is there a way to do this with one pattern?

Perhaps you could put two captures in your pattern: the first one anchored at the beginning of the string, with 0 or 1 occurrences (?) of the non-escaped quote, then '.-' and the second one like you posted. Then you could combine the two captures with 'or', so that if the first one fails you get the second one.

Implementation details are left as an exercise to the reader. I'm lazy :-)