Know what regular expressions (regexes) are good for, and what they don't do well at all.
Use regexes for:
- Matching text against a pattern
- Substituting strings when they match a pattern (find and replace)
- Validating attributes against a pattern
- The best way to validate an email address beyond idiot-checking is to send mail to it and confirm receipt.
- Parsing data such as log files with defined delimiters or separators. Some exceptions are listed below.
Do not use regexes for: