|
|
|
|
|
by keeperofdakeys
5007 days ago
|
|
I hope no one is seriously suggesting that regular expressions should be used in programs, such as email address verification and http parsing. As well as being incredibly slow, they are hard to read, and inferior to application-specific parsers (for example, sometimes non-RFC-compliant emails are actually valid, and dealing with whitespace in html is a nightmare). For the interactive case, the ability for them to be written quickly is what makes them so helpful, and an abstraction library could take away this advantage. |
|
1. How can a non-RFC-compliant email be valid?
2. What about compiled regexes, performance-wise?
3. Sometimes a regex is faster than the overhead of a parser, so wouldn't the choice be dependent on context? In other words, regexes are not always slower, true?
4. Wouldn't some abstraction libraries utilize regexes under the hood? Would that be wrong in your view?
P.S. Some languages allow the option for very readable regexes, e.g. separate each component on its own line, with a comment.