4 ms·
This is a great solution to what is mostly a non-problem. It's also not the first one of its kind. Regular expressions should be used so sparingly that you don
by IceDane 6y ago
This is a great solution to what is mostly a non-problem. It's also not the first one of its kind.
Regular expressions should be used so sparingly that you don't need an entire library to write them safely. If you're ever writing a regular expression and find yourself needing something like this to keep it under control, IMO you should step back and consider just writing some actual code instead. Use a proper parser if you're doing a complicated parsing job, or if you're doing data validation, you can generally just reify your predicates as boolean functions, or you might reach for something like joi or a similar library.