The issue: Regex can consume a lot of time
- Prefer over PCRE over EREG (much more powerful and faster!)
- Bad written regex can consume tons of time (backtracking)
- C implemented functions are always faster than regex
The solution: Think twice about each regex
- Is there really need for a regex or does a PHP function do the trick?
- Replace all your EREGs with PCREs
- Try to avoid backtracking as much as possible (U modifier, if necessary)
- Reading recommendation: Mastering Regular Expressions (http://www.oreilly.com/catalog/regex/)