Thank you all for your kind answers.
Originally posted by kburger
Unless I'm missing something, and when it comes to regex I probably am, wouldn't the pattern be [a-zA-Z0-9.-] rather than just [A-Z0-9.-]?
Or use the "i" modifier?
[A-Z0-9.-_] would not include lowcase letters a-z, but email could as well be using those.
e modifier instead of the i modifier is required to render the replace pattern as a PHP code.
Originally posted by bradgrafelman
Also, should "strtoupper('$0')" be in quotes? It's a function.. I wouldn't think so...
I followd preg_replace documentation for the e modifier available here. It claims to render everything between the double quotes as a PHP code.
I am pretty convinced that this issue has arised cos of the regex I use to match the email.
PS, it will work properly with i modifier, but unfortunately, as I already mentioned, it will not execute any function in the replace pattern.