On Wed, 2 Jun 2010 12:14:47 -0400
Alice Wei <aj...@alumni.iu.edu> wrote:

> 
> Hi, 
> 
> I have a code snippet here as in the following:
> 
> [CODE]
> $keywords = preg_split("/[\s,]+/", $day);
> $count = count($keywords);
>   if(preg_match("(Mon|Tue|Wed|Thu|Fri)/i", $keywords[$i])) { //line 40
>    $day_query ="start_time.day='12345' AND end_time.day='12345'";  
>    }  
>    if(preg_match("Sat/i", $keywords[$i])) { //line 43
>    $day_query = "start_time.Sat_route != 'NULL' AND end_time.Sat_route != 
> 'NULL'";
>    }  
>    else {
>    echo $keywords[i] . " is not a term that exists in the database. Make sure 
> the pattern looks like <b>Mon, Tue</b><br />";
>    footer();
>    exit;
>    }
> [/CODE]
> 
> For some reason, when I type in Mon, Tue
> 
> It gives me this: 
> 
> Warning: preg_match() [function.preg-match]: Unknown modifier '/' in line 40
> Warning: preg_match() [function.preg-match]: Delimiter must not be 
> alphanumeric or backslash on line 43
> is not a term that exists in the database. Make sure the pattern looks like 
> Mon, Tue

You need a leading slash as a delimiter, eg
"/Sat/i"
also note that you will match any phrase that contains 'sun', 'mon' etc, which 
can also have irrelevant text, eg 'Mars Jupiter Saturn' will match, but thats 
probably not what you want
-- 
Simcha Younger <sim...@syounger.com>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to