Re: regex

From: Date: Thu, 19 Oct 2006 13:57:13 +0000
Subject: Re: regex
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-243338@lists.php.net to get a copy of this message
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.

« previous php.general (#243338) next »