lua-users home
lua-l archive

Re: Regex 'Absent Operator'

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


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.

AltStyle によって変換されたページ (->オリジナル) /