Get rid of non-alphanumeric with RegexReplace

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Get rid of non-alphanumeric with RegexReplace

Post 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?
Power-hungry user!!!

highend
Posts: 14955
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Get rid of non-alphanumeric with RegexReplace

Post by highend »

Sure:

Code: Select all

$a="._ abc#123!%&"; $b=regexreplace($a, "([^a-zA-Z0-9]+)", ""); text $b;
One of my scripts helped you out? Please donate via Paypal

tiago
Posts: 589
Joined: 14 Feb 2011 21:41

Re: Get rid of non-alphanumeric with RegexReplace

Post by tiago »

That solved, thanks!
Power-hungry user!!!

Post Reply