I want to match a URI (includes a path and a UUID) that looks like this via a javascript regex:
/account/0006a8a6-b301-4168-b7de-964773a1ec66
The regex I have come closest to is this:
^\/([a-zA-Z0-9_\.~-]+)\/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})
Works fine for capturing the above – I get a match and it captures as two groups.
However, if I enter this as the URI:
/account/0006a8a6-b301-4168-b7de-964773a1ec66DSSSSSS
The regex still matches and captures the two groups, and the second match is still just the UUID, but I need it to actually fail the match and not capture anything due to the DSSSSS appended at the end. How can I change around my regex to accomplish this?
You forgot to add the end of line anchor
$