geongeorge / i-hate-regex

The code for iHateregex.io 😈 - The Regex Cheat Sheet
https://iHateRegex.io
4.5k stars 320 forks source link

Aren't the `\b` in the UUID regex superfluous? #89

Open guillaumealgis opened 2 years ago

guillaumealgis commented 2 years ago

I'm not convinced the \b in the UUID regex serve any purpose. Why are we trying to match word boundaries here?

^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$

(I tested the regex without the \b and the same strings match or don't match)

@alex-hofmann do you remember why you added those?

alex-hofmann commented 1 year ago

@guillaumealgis apologies for seeing this [not quite] a year since you asked. There's no reason for them, that I can remember, and with fresh eyes I would not include them.

It looks like the \b's are still out there, so one of us can likely PR an edit

guillaumealgis commented 1 year ago

@alex-hofmann no worries ☺️

I won't bother with a PR, the repo hasn't seen activity since sept 2021 :)