Re: Regexp Oddity
| From: | trlists at clayst dot com | Date: | Thu, 11 Mar 2004 14:43:59 +0000 |
| Subject: | Re: Regexp Oddity | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-180154@lists.php.net to get a copy of this message | ||
On 11 Mar 2004 Raditha Dissanayake wrote:
> print "Matches: " . preg_match('/((?i)rah)\s+\1/', "RAH RAH") .
> "\n";
> print "Matches: " . preg_match('/((?i)rah)\s+\1/', "rah rah")
> .
>
>
> is what you should use.
Oh. Of course -- I knew it was obvious! This also works:
print "Matches: " . preg_match("/(a)\\1/", "aa") . "\n";
print "Matches: " . preg_match("/((?i)rah)\\s+\\1/", "RAH RAH") .
"\n";
print "Matches: " . preg_match("/((?i)rah)\\s+\\1/", "rah rah") .
"\n";
--
Tom