You are here: Re: Regex with a '*' in it? « PHP Programming Language « IT news, forums, messages
Re: Regex with a '*' in it?

Posted by dr_phill123 on 05/14/07 21:01

Thomas Mlynarczyk wrote:
> The * is a special character in regular expressions, but here you want to
> use it as a normal one. So it must be escaped: '\* Hello World'. And I think
> you mixed up the parameters. This should work:

Thanks that is a good solution. Another one I discovered is to use \Q
as
in. The \Q escapes the whole string. I just remembered it from my
perl
days...

if ( preg_match ( "/\Q$match/", $test ) ) echo "Matched";

 

Navigation:

[Reply to this 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

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