Posts: 256
Location: Auckland, New Zealand
|
Actually Paul F's pattern is incorrect, a-Z is a larger range than what you want.
Just for performance, preg_replace is faster than ereg_replace, though I'm not sure whether using modifiers for case sensitivity is faster or not, in my tests it made marginal difference.
PHP Code:
$input = preg_replace('/[^a-zA-Z0-9 ]/', '', $input);
Cheers,
MC
__________________
#------------------------------ signature---------------------------------------------------------------------------------#
Quote:
|
I am well recognised for what I don't do than what I do. Chores are just one of those things.
|
Last edited by mastercomputers; 08-17-2006 at 01:39 AM..
|