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.
preg_replace and percentage sign
Moderator: General Moderators
- ridgerunner
- Forum Contributor
- Posts: 214
- Joined: Sun Jul 05, 2009 10:39 pm
- Location: SLC, UT
Re: preg_replace and percentage sign
Please post the code you are using that breaks. Also provide some "before" and "after" text that the preg_replace is supposed to accomplish.