Re: preg_replace on digit word boundry in 2 lines how about 1?
| From: | Mahmoud | Date: | Tue, 19 Mar 2002 20:08:24 +0000 |
| Subject: | Re: preg_replace on digit word boundry in 2 lines how about 1? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89190@lists.php.net to get a copy of this message | ||
Hi,
Don't know if it's the best way, but it works:
<?php
$digiword = "123joe123";
$replace =
preg_replace("/(\d)(\D)/","\\1,\\2",preg_replace("/(\D)(\d)/","\\1,\\2",$dig
iword));
print $replace;
?>
will print 123,joe,123
Regards,
Mahmoud