RE: [PHP-WIN] ereg_replace help wanted
| From: | trlists at clayst dot com | Date: | Wed, 29 Sep 2004 17:28:28 +0000 |
| Subject: | RE: [PHP-WIN] ereg_replace help wanted | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-24669@lists.php.net to get a copy of this message | ||
On 29 Sep 2004 George Pitcher wrote:
> In short I'm looking to search for any character that is NOT one of the
> following:
>
> "0-9 cdilmvx ," and replace it with '-' [chr(45)] (I do an initial strip of
> spaces at the beginning of the process).
Try something like:
$newstring = preg_replace('/[^cdilmvx0-9,]/', '-', $string);
But do you really want an "A" (etc.) to be considered a dash?
--
Tom