Zero-length matches are often an unintended result of mistakenly making everything optional in a regular expression. Sometimes they can be useful. In browsers like Firefox, zero-length matches can cause your JavaScript code to loop forever on regex.exec().
Backtracking occurs when the regular expression engine encounters a regex token that does not match the next character in the string. The regex engine will then back up part of what it matched so far, to try different alternatives and/or repetitions. Understanding this process will make all the difference between guessing and understanding why a […]
The general rule is to only escape a character only if it really has to be escaped.
The wxRegEx class in the wxWidgets library encapsulates the Advanced Regular Expressions engine developed by Tcl. I’ve added a page of detailed documentation for this class to www.regexp.info. RegexBuddy now includes a template for generating C++ source code snippets using wxRegEx.
I’m sorry, but this blog really isn’t a place for personal advice on regular expressions. Suggestions for topics that I should write about are very welcome.
PHP’s preg_replace_callback() function allows you to do a search-and-replace using a dynamically generated replacement text which can be different for each regex match.
People get used to established standards. Even bad ones. If you come up with something better, make sure to explain it clearly, or brace yourself for lots of complaints you’re not following the old ways.
Being overly strict about what input your program or web site accepts makes it hard to use. Being overly lax causes compatibility headaches with future versions.
Recap of 4 articles on regular expressions pitfalls I previously posted to www.regular-expressions.info
Example regular expressions to check if a series of digits looks like a valid credit card number for any of the major brands.
It’s easier to use a trivial regex to strip out spaces and dashes from credit card numbers than to blame the customer for typing them in.
Introducing the Regex Guru blog.