I must be missing something obvious ... I am trying to use 
backreferences in a PCRE regexp to check for a repeated character, but 
they don't seem to work.  I've used regexps often before, but never 
needed backreferences.

For example this:

        print "Matches:  " . preg_match("/(a)\1/", "aa");

prints:

        Matches:  0

It should be 1.

In addition the basic examples in the manual fail.  The manual says:

    For example, ((?i)rah)\s+\1  matches "rah rah" and "RAH RAH", but
    not "RAH rah", even though the original capturing subpattern is
    matched caselessly. 

I tested this with:

        print "Matches:  " . preg_match("/((?i)rah)\s+\1/", "RAH RAH") . "\n";
        print "Matches:  " . preg_match("/((?i)rah)\s+\1/", "rah rah") . 
"\n";

Both show 0.

For this test I'm running PHP 4.3.1 on Windows 2000.

What am I missing?

--
Tom

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

Reply via email to