Hi,

I have a code snippet here as in the following:

if(preg_match("(Mon|Tue|Wed|Thu|Fri)/i", $keywords[$i])) {
   $day_query ="start_time.day='12345' AND end_time.day='12345'";  
   }  
   if(preg_match("Sat/i", $keywords[$i])) {
   $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;
   }

For some reason, when I type in Mon, Tue

It gives me this:

Warning: preg_match() [function.preg-match]: Unknown modifier '/' in /var/www/Alice.Wei/web/instruction/trip_planner3.php on line 42

Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in /var/www/Alice.Wei/web/instruction/trip_planner3.php on line 45
is not a term that exists in the database. Make sure the pattern looks like Mon, Tue

Have I done something wrong here?
Thanks for your help.

It looks like you're missing the slash at the beginning of your regular expression.

preg_match("/(Mon|Tue|Wed|Thu|Fri)/i", $keywords[$i])
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.