Reply to Re: regular expression

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация