Log in

View Full Version : Character stripping


Revan
03-20-2006, 07:13 PM
Well Im gonna be a man and fess up to a limitation I have in PHP, which is regex. And Im in need of some right now.
I need a regex function that strips ALL characters that's not A-Z and 0-9. I've tried alittle here and there but I'm stumped.

Can anyone help?

Edit: Solved.
ereg_replace("[^a-zA-Z0-9]", '', $string);
Wow, I thought it'd be much more complex code :surprised:

Zachery
03-20-2006, 09:40 PM
If you hadn't fixed it I would have said to look at my vBXirc code :)