Reply to Re: Regex with a '*' in it?

Your name:

Reply:


Posted by Schraalhans Keukenmeester on 05/14/07 20:32

At Mon, 14 May 2007 13:20:26 -0700, dr_phill123 let his monkeys type:

> The following code gives this warning, any suggestions?
>
> Warning: preg_match(): Compilation failed: nothing to repeat at
> offset 0 in test.php on line 6
>
> =========================
>
> $match = '* Hello World';
> $test = '* Hello';
>
> if ( preg_match ( "/$match/", $test ) ) echo "Matched";

Escape the * (\*) so it loses it's special meaning inside the regex.
Sh.

[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

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