View Single Post
Old 05-15-2008, 02:14 PM   #2 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

The problem lies in the final character class definition [_a-z\d\-\\\/], the escaping back slashes cause it. They're interpreted (by the PHP parser) to be \\/ which the regex parser decides is a single backslash followed by a forward slash, the pattern delimiter. To match a backslash, you'll need four consecutive backslashes (plus 1 escaping the forward slash!): [_a-z\d\-\\\\\/]

It might also make life easier if you use a different delimiter for the pattern, which would save you having to escape all of those forward slashes: ~test://~ vs /test:\/\//
Salathe is offline  
Reply With Quote
The Following 2 Users Say Thank You to Salathe For This Useful Post:
Kenylieou (06-06-2008), Village Idiot (05-15-2008)