Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#5 Use preg_quote() instead?

open
nobody
None
5
2009-10-30
2009-10-30
David Pennington
No

I'm wondering why some of the functions manually quote meta characters in the regex rather than using preg_quote()?

//quote charlist for use in a characterclass
$charlist = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$charlist);

Discussion