Re: regex

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

 



On 19 Oct 2006, at 07:56 , John Nichel wrote:
$var3 = 'abc 20 def';
Then we want output like :
$var3 = 'abc def';
How regex can help us?.

Use preg_replace to replace all numbers with nothing.

$var = preg_replace ( "/\d+/", "", $var );

Nope, that will leave

$var3 = 'abc  def';

(note the double space)

it will also leave $var1 = 'abcdef ';


--
The trouble with being a god is that you've got no one to pray to.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux