View Single Post
Old 02-23-2009, 11:50 AM   #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 regex pattern contains the string </span>. Since your delimiter is the forward slash, the pattern parser tries to stop read a pattern at the second forward slash which in this case is actually part of the closing span tag and not really the end of your pattern! Since the parser thinks the pattern has ended at that forward slash, it starts looking for modifiers. s is a valid one (which is why no error is raised there) but p isn't.

Solutions:
1. Use a different delimiter which won't be used in your pattern (popularly tilde ~mypattern~modifiers).
2. Escape the delimiter in your pattern: </span> becomes <\/span>
Salathe is offline  
Reply With Quote