Page 1 of 1

Get rid of non-alphanumeric with RegexReplace

Posted: 01 May 2012 22:31
by tiago
Is there a way regexreplace to get rid of all non-alphanumeric characters on a string? How?
If not, what's the alternative method?

Re: Get rid of non-alphanumeric with RegexReplace

Posted: 01 May 2012 23:16
by highend
Sure:

Code: Select all

$a="._ abc#123!%&"; $b=regexreplace($a, "([^a-zA-Z0-9]+)", ""); text $b;

Re: Get rid of non-alphanumeric with RegexReplace

Posted: 02 May 2012 00:57
by tiago
That solved, thanks!