I have a regular expression:
^\/admin\/(?!(e06772ed-7575-4cd4-8cc6-e99bb49498c5)).*$
My input string:
/admin/e06772ed-7575-4cd4-8cc6-e99bb49498c5
As I understand, negative lookahead should check if a group (e06772ed-7575-4cd4-8cc6-e99bb49498c5)
has a match, or am I incorrect?
Since input string has a group match, why does negative lookahead not work? By that I mean that I expect my regex to e06772ed-7575-4cd4-8cc6-e99bb49498c5
to match input string e06772ed-7575-4cd4-8cc6-e99bb49498c5
.
Removing negative lookahead makes this regex work correctly.
(?!.*e06772ed-7575-4cd4-8cc6-e99bb49498c5$)
– Wiktor Stribiżew/admin/e06772ed-7575-4cd4-8cc6-e99bb49498c5
or not? – Wiktor Stribiżewe06772ed-7575-4cd4-8cc6-e99bb49498c5
. As this assertion fails, the whole match is discarded.Do y ou need a positive lookahead maybe? – Sebastian Proskeuser1/e06772ed-7575-4cd4-8cc6-e99bb49498c5
your regex would match both it andadmin/e06772ed-7575-4cd4-8cc6-e99bb49498c5
. That's incorrect. – CrazySabbath