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.
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 [...]
Recap of 4 articles on regular expressions pitfalls I previously posted to www.regular-expressions.info