What does the regular expression, /(?!^)/g mean?
I can see that from here x(?!y): Matches x only if x is not followed by y.
That explains, if ?! is used before any set of characters, it checks for the not followed by condition.
But we have, ?!^. So, if we try to say it in words, it would probably mean not followed by negate. That really does not make me guess a probable statement for it. I mean negate of what?
I'm still guessing and could not reach a fruitful conclusion.
Help is much appreciated.
Thanks!
Circumflex ^ only implies negation in a character class [^...] (when comes as first character in class). Outside of it it means start of input string or line. A negative lookahead that contains ^ only, means match shouldn't be found at start of input string or line.
See it in action
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With