On 19/10/06, Bagus Nugroho <bnugroho@xxxxxxxxxxxx> 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';
$re = '/^\s+|\d+\s*|\s*\d+\s*$/'; $var1 = preg_replace($re, '', $var1); It may or may not be what you're after, but it handles all your examples. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php