Last Friday Jeff Atwood makes a case for judicious use of regular expressions in the article Regular Expressions: Now You Have Two Problems on his Coding Horror blog.
Nitpick: In free-spacing mode (RegexOptions.IgnoreWhitespace in .NET), the # starts a comment all by itself, which runs to the end of the line. # comment is three [...]
I’m co-writing a book on regular expressions. This blog will likely be quiet until we’re done writing the book.
The regular expression from the Do Follow plugin is dedicated to a single purpose. Repurposing it for your own code will expose shortcomings that don’t matter for the plugin, but may matter for what you’re trying to do. Never copy-and-paste a regex without testing it.
The popular Do Follow WordPress plugin uses a rather inefficient regular expression for its job. Here’s how to improve it.
A RegexBuddy user pointed me to LIB_MYSQLUDF_PREG. This is an open source library of MySQL user functions that imports the PCRE library.
MySQL’s built-in regular expression support uses the POSIX ERE flavor. By todays standards, that flavor offers limited regex functionality. PCRE on the other hand offers all the goodies from Perl and [...]
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 [...]
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.