RE: [PHP] For the reg ex people
| From: | Craig Vincent | Date: | Mon, 14 Aug 2000 18:04:49 +0000 |
| Subject: | RE: [PHP] For the reg ex people | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11654@lists.php.net to get a copy of this message | ||
> I'm trying to replace all "-" with any whitespace on either side in a
> string with a regular "-" with not whitespace. Something like this:
>
> "The news today is - something" would end up like
> "The news today is-something"
Although you'd probably be better off using the POSIX descriptors in the
regex...
$variable = ereg(' - ','-',$variable);
should do the trick for you.
Sincerely,
Craig Vincent
-------------------------
Senior Programmer
Jazzmonkey Media Inc.
http://www.jazzmonkey.com
-------------------------