in reply to Re: Re: negative lookaheads doing my 'ead in
in thread negative lookaheads doing my 'ead in

The reason it matches is because the immediate preceeding whitespace is optional \s*. Therefore the parser can choose to say that if there is no whitespace, then the next char after the second (\w+) is a space, which isn't '<=' so therefore is can match, so it does.

Change that to be if (/^\s*(?!for all)(\w+)\s*:\s*(\w+)\s+(?!<=)/i) { and it no longer can match, so it doesn't (if you get my drift.

I realise that may or may not help you.

++Jasper below. I couldn't find a way of doing that. The caveat is that if you wanted to match

'cidr_enable: en_core_id == NOT(dsp_reset_n) AND <= stuff;'

your out of luck.


Nah! You're thinking of Simon Templar, originally played (on UKTV) by Roger Moore and later by Ian Ogilvy