Sergey Senkov
Sergey Senkov

Reputation: 1540

Regexp negative check of word in group

My template is here:

https://regex101.com/r/6z8X43/3

My issue is Second group in Match 7:

([^\/\n]*)

this.text = text;

It means any characters, except / or "new line" untill .text

But I need to add "this" word to this negative check, so this.text should be invalid. Something like ([^\/\n|this]*) - not /, not \n and not exactly "this".

Upvotes: 2

Views: 96

Answers (1)

Jan
Jan

Reputation: 43169

You could use

^([ \f\t]*)((?:(?!this)[^\/\n])*)\.text\s*=[ \f\t]*([^$;\n=]+)
#                ^^^^^

See your modified demo.

Upvotes: 2

Related Questions