[thelist] preg_replace quickie

Matt Warden mwarden at gmail.com
Fri Sep 16 08:33:23 CDT 2005

On 9/16/05, Alex Beston <alex at deltatraffic.co.uk> wrote:
> hi Evolt
> I have a search string and i want to remove anything that isnt   a - z
> or A - Z or 0 - 9 replacing with a space character
> (using php preg_replace, presumably)
> how do i do this?

I would suggest that you do take time to learn regular expressions,
ASAP. It's invaluable.

preg_replace('[^a-zA-Z0-9]', ' ', $subject);

Matt Warden
Miami University
Oxford, OH, USA

This email proudly and graciously contributes to entropy.

More information about the thelist mailing list