Re: regex

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

 



On 19 Oct 2006, at 07:49 , Bagus Nugroho wrote:

Hi All,

If we have variable like :

$var1 = 'abcde 12';
$var2 = 'abcdefghi 34';
$var3 = 'abc 20 def';

Then we want output like :
$var1 = 'abcde';
$var2 = 'abcdefghi';
$var3 = 'abc def';

How regex can help us?.

Well, stripping the digits is easy

s/ \d+//

(have that space before the number if there will ALWAYS be a space before the nu,bers you want to remove.


--
You try to shape the world to what you want the world to be. Carving your name a thousand times won't bring you back to me. Oh no, no I might as well go and tell it to the trees. Go and tell it to the trees, yeah.

--
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