Page 1 of 1

preg_match question

Posted: Sun Jun 28, 2009 5:08 pm
by bobb
I am experimenting, and doing the following:

Code: Select all

<?
if(preg_match('_'.preg_quote("Charlotte[/ ]([0-9a-z.]{1,10})", '_').'_', "Mozilla/5.0 (compatible; Charlotte/1.0t; http://www.searchme.com/support/)")) {
 
    echo "<br>A match was found.";
} else {
    echo "<br>A match was not found.";
}
?>
But this returns :A match was not found... How is this possible? I want to have A match was found, but I don't know where my fault is in my code... is it in the

Code: Select all

 
Charlotte[/ ]([0-9a-z.]{1,10})
 

part?

thanks

Re: preg_match question

Posted: Sun Jun 28, 2009 5:13 pm
by a94060
Regex Forums may be more helpful. It is focused around regular expressions(regex) involving functions like preg,ereg,etc.

Re: preg_match question

Posted: Sun Jun 28, 2009 5:23 pm
by bobb
Thanks, I posted a thread there, this one can be deleted/locked :)