preg_replace and percentage sign
Posted: Tue Mar 09, 2010 3:21 am
I'm using PHP preg_replace to replace all characters except alphabetic and numeric values.
The regex looks like this: /[^a-zA-Z0-9]/u
Now I want to exclude the percentage sign from being replaced also.
So normally the regex would look like this /[^%a-zA-Z0-9]/u , which seems to work with the Dreamweaver regex search tool.
When used with preg_replace, the regex breaks.
I've been searching for hours on how to resolve this, but cannot find a single clue.
The regex looks like this: /[^a-zA-Z0-9]/u
Now I want to exclude the percentage sign from being replaced also.
So normally the regex would look like this /[^%a-zA-Z0-9]/u , which seems to work with the Dreamweaver regex search tool.
When used with preg_replace, the regex breaks.
I've been searching for hours on how to resolve this, but cannot find a single clue.