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

Re: a little PHP reg exp help pls



preg_replace("/[^0-9]/","",$my_string);

Since this is a Perl comaptible reg ex, you need
the delimiters around the expression (slashes)

Cheers,
Marcel

Chad A. Adlawan <chadi@linux.com> 26 Mar 2001, at 20:07:

> 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);
> 
> but, i get this error: Warning: No ending delimiter found in
> /var/www/html/mm/tmp2.php3 on line x
> 
> can somebody help me do this correctly pls?
> 
> thanks a lot in advance,
> chad
> 
> 
> INXS: "perl -pi -e 's|[^0-9]||g' file.here" works perfectly in command
> line perl.  so what did i do wrong when i tried it in PHP?
> 
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail. 
> http://personal.mail.yahoo.com/?.refer=text
> 
> 
> --  
> To UNSUBSCRIBE, email to debian-isp-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact
> listmaster@lists.debian.org
> 




Reply to: