Regex Guru

Thursday, 8 May 2008

Follow Up with Adequate Testing

Filed under: Regex Trouble — Jan Goyvaerts @ 15:05

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.

No Follow The Lazy Dot

Filed under: Regex Trouble — Jan Goyvaerts @ 8:31

The popular Do Follow WordPress plugin uses a rather inefficient regular expression for its job. Here’s how to improve it.

Tuesday, 15 April 2008

Watch Out for Zero-Length Matches

Filed under: Regex Trouble — Jan Goyvaerts @ 14:51

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().

Tuesday, 8 April 2008

Unintended Backtracking Can Bite You

Filed under: Regex Trouble — Jan Goyvaerts @ 17:01

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 [...]

Friday, 14 March 2008

Regex Trouble

Filed under: Regex Trouble — Jan Goyvaerts @ 8:49

Recap of 4 articles on regular expressions pitfalls I previously posted to www.regular-expressions.info