Re: Re: replacing chars in input

From: Date: Tue, 23 Mar 2004 22:00:47 +0000
Subject: Re: Re: replacing chars in input
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-181316@lists.php.net to get a copy of this message
Justin, et al -- ..and then Justin Patrin said... % % David T-G wrote: % % >I would like to make things easier for my users and replace all of the % >garbage characters % > % > `'";:~!@#$%^&*()[]{}<>/?\|+= % > % >plus white space (\s) with underscores in the input. I am, however, % >having trouble getting my regexp to work. .. % > % >If there isn't a handy character class waiting for me, what must I do to % >get those chars replaced? % % $i = preg_replace('/[^A-Za-z0-9_-]/', '_', $i); % % That means anything that is not in that class should be replaced with '_'. *duh* Of course! Brilliant in its simplicity. I can't wait to try it. % % -- % paperCrane <Justin Patrin> Thanks & HAND :-D -- David T-G * There is too much animal courage in (play) davidtg@justpickone.org * society and not sufficient moral courage. (work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

« previous php.general (#181316) next »