the following is a simplification of a regex i am using. on my development machine both $pattern1 and $pattern2 return a match, however on my production machine only $pattern1 returns a match! clearly the only difference between $pattern1 and $pattern2 is that one of them has brackets around a word. however both are valid patterns which should match the given haystack (as far as i know).
$pattern1 = '/\<a name="ERROR TEXT"\>\<\/a\>\s*?validated\s*?\<\/span\>\s*?\<\/h1\>/';
$pattern2 = '/\<a name="ERROR TEXT"\>\<\/a\>\s*?(validated)\s*?\<\/span\>\s*?\<\/h1\>/';
$haystack = '- IFCS msg value, BOOKMARKED AS ERROR TEXT -->
          <a name="ERROR TEXT"></a>
             validated</span>
       </h1>
                <!-- START: .formActionHolder -->
                <div class="formActionHolder">';
preg_match($pattern1, $haystack, $matches);
print_r($matches);
has anyone found this problem before? note that this is not the whole of the regex - this is a simplified version which i have identified as being the problem. in my actual code, the value of 'validated' is not a constant - hence my reason for using brackets to capture the word. of course the patterns have other characters within the parenthesis as well so that i can capture the variable words here. this is just a simplified example which hones in on the problem that i am having with two seemingly fine regexes.
on my development machine i am using php5.3.2 with the pcre 7.8 library and on my production machine i am using php5.2.4 with pcre 7.4.
 
     
    