|
Posted by Rik on 01/21/07 02:18
windandwaves wrote:
> How can I write the thing below as a regular expression
> (preg_replace)?
>
> $array = array("-0", "-1", "-2", "-3", "-4");
> $key = str_replace($array, "", $key);
I would normally not use a regular expression for this (str_replace is
often faster), but here you go:
preg_replace('/-[0-4]/','',$key);
> I am trying to learn regular expressions, but I find them hard and
> this seems like a really simple place to start....
http://regularexpressions.info
--
Rik Wasmus
Navigation:
[Reply to this message]
|