[UPHPU] Regex help.

Ben Reece breece at doba.com
Fri Jan 30 13:58:20 MST 2009


> It's just a text file, so I could run sed on it, but how do you test 
> for just those characters?

Ash,
    Using sed should do it for you -- something like this:

        sed "s/[^a-zA-Z0-9,()':. \t]//g" file.txt > newfile.txt

That's saying to replace anything not in the list with nothing.  I added 
space and tab (\t) to the end, as well.

--
Ben Reece
Director of Engineering, Doba <http://www.doba.com/>
801.765.6123
breece at doba.com <mailto:breece at doba.com>



More information about the UPHPU mailing list