[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Regex 'Absent Operator'
- From: Pierre-Yves GĂ©rardy <pygy79@...>
- Date: Mon, 27 Mar 2017 13:47:59 +0200
On Mon, Mar 27, 2017 at 12:25 PM, Scott Morgan <blumf@blueyonder.co.uk> wrote:
> [0] That is '/* okay */' but avoiding '/* wrong */ */'
using Regexes, you can either use non-greedy repetition
/\/\*.*?\*\//
or negative lookahead in a non-capturing group:
/\/\*(?:(?!\*\/).)*\*\//
(Assuming that /./ matches every character including new lines)
Both will match "/* wrong */"
> Worth considering for Lua's pattern match system?
I don't think so. Operators in Lua patterns only apply to the last
character or character set, and you can already use [^...] for that
purpose.