There is a part of the regular expression that I don’t understand.
text: 123google
.*(?!google)
Why does ‘123Google’ match?
(.*)(?!google)
If it’s confirmed in the capture group, ‘.*’ It’s not “123”. It’s “123 google”.
Does it match because there is no “g” after “123google”?
Or is there another reason why I didn’t think about it?
That’s what I’m going to do ‘.*’ Does it always mean all strings before looking forward negatively?
(.*)(?=google)
In Positive Look Ahead, ‘.*’ matches ‘123’ rather than a full string.
(.*)(?!google)
In negative lookahead, why does .* match the entire string? What characters must precede the
look around expression?
d+(?!google)
Why is only ’12’ matched in ‘123google’?
(?!.*google)*
Why only the back “o o g l e” matches in “123google”?
I’d like to know the reason and the principle.
We look forward to hearing from you clearly to resolve your questions.
seyo g is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1