View Single Post
Old 01-19-2006, 03:51 AM   #4 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 732
DJMaze is on a distinguished road
$ and ? also need to be properly backslashed due to the double quoting
On single quoting only the ?

This is because the following chars are special in
regex: .*?|
php: $

SDE uses "/[\.\*$?\"\/\|\\:<>]/" which makes / also a special char
Another way is bash: "#[\.\*$?\"/\|\\:<>]#"

preg_match("/[\.\*\$\?\"\/\|\\:<>]/"
preg_match('/[\.\*$\?"\/\|\\:<>]/'
preg_match('#[\.\*$\?"/\|\\:<>]#"

As you can see there are several solutions to a single problem, so use the one you like most.
DJMaze is offline   Reply With Quote