[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: a little PHP reg exp help pls

On Mon, Mar 26, 2001 at 08:07:45PM -0800, Chad A. Adlawan wrote:
> hi!
> i would like to search out all non-numeric characters in my string and replace
> them with nothing in PHP.
> i tried
> preg_replace("[^0-9]","",$my_string);
use strtr in this case, for preg_replace, you should use '/[^0-9]/'

use strtr to replace some chars, regexps are a bit overkill for this

> Name:           Alson van der Meulen      <
> Personal:       alson@linuxfreak.nl       <
> School:       alson@gymnasiumleiden.nl    <
Do you really need your home directory to do any work?

Reply to: