Not operator in regular expression
| From: | David Newcomb | Date: | Fri, 28 Jul 2000 11:23:13 +0000 |
| Subject: | Not operator in regular expression | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-8762@lists.php.net to get a copy of this message | ||
Hi all,
Help!
I have a variable
$t="this IS h_ard 12 ! etc";
and I want to return
$t="thisISh_ardetc";
I would like to remove all characters which are not [a-zA-Z_]
Is there a regular expression operator for NOT so I don't
have to list all the alternatives?
Some thing like:
echo ereg_replace("~[a-zA-Z_]","_",$t);
Regards,
David.