Regex Exlude a String if Followed by a Particular String -


i have seen answers here , tried implement them unsuccessfully.

basically, want include @generated. however, if '@generated' followed 'not', such @generated not, want exclude that.

here attempt: ^/(?!not)(@generated)$

i tested on regex pal , not work. furthermore, cannot find pattern works reliably. instance, don't want accidentally tag not when @generated not precede it.

you use below regex,

@generated(?!\s*not) 

demo

it match word @generated not followed 0 or more spaces , string not.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -