Re: hot to use perg_match with multi strign patern
| From: | Wendell Brown | Date: | Wed, 07 May 2003 15:20:31 +0000 |
| Subject: | Re: hot to use perg_match with multi strign patern | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146686@lists.php.net to get a copy of this message | ||
On Wed, 7 May 2003 10:59:38 -0700, qt wrote:
>Where is my problem?
>
>if (preg_match("/(yes)?(no)/i", $mesage, $matches)) {
> print "refusee - $matches[0]";
>} else {
> print "negative";
>};
Try "|" (perl or) instead of "?" --- like this:
if (preg_match("/(yes)|(no)/i", $mesage, $matches)) {
print "refusee - $matches[0]";
} else {
print "negative";
};
You aren't using Perl Regular Expressions. ;)