I really appreciate the "examples in the wild" along with pointing to the solutions in the source code.
And I've now learned about a regex debugger. Which is cool.
Also funny seeing one of the issues being "validating an email", which I'm fairly certain the only real way to do this is to check for an @
symbol on the string, and then validate it by sending an actual email.
I also find it amusing that the solution to problematic regex was to use native string functions. Backing up the "you have a problem, you use regex, now you have 2 problems" saying.
Although, endsWith
was only introduced in 2015. So I can understand someone thinking "regex" (even though a string comparison with a substring is functionally equivalent and probably more understandable than a regex, even if it is a little clunky)