Re: hot to use perg_match with multi strign patern
| From: | SLanger at spirit21 dot de | Date: | Thu, 08 May 2003 06:40:24 +0000 |
| Subject: | Re: hot to use perg_match with multi strign patern | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146788@lists.php.net to get a copy of this message | ||
Hello
> $pos = strpos($mesage, "/(?:yes|no)/i");
When you use string functions don't specify a regular expression simply
specifiy the word you are looking for.
So in the above case you have to test two times
1. strpos($message, "yes")
2. strpos($message, "no")
Depending on how many words you have to check this should be faster. Use
regular expressions if you want to check for words that can not be
expressed with a literal word.
Be sure to test which is faster in your case strpos or preg_match.
Regards
Stefan Langer