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)
it match word @generated
not followed 0 or more spaces
, string not
.
Comments
Post a Comment