I want to match ___ except within {}:
https://regex101.com/r/PYRWIA/1
I don't understand why it match though with
/___\s*\n*(?!})/
CodePudding user response:
FIrst of all there is no need to use \n in your regex since \s matches line break also.
Second issue is with use of * (0 or more occurrences) in your regex since \s* will let negative lookahead condition being met right after last dash since next character is a line break not }.
You can use any of these 2 patterns:
___(?!\s*})
___\s (?!})
