I am trying to debug a regular expression, and for a living I canβt understand why it works in a test file, but not elsewhere.
I get a raw HTTP response and analyzed the section of interest:
UID:5F12F7DA-10B0-4EE3-820D-B56F0B2FC153
DTSTAMP:20120408T041113Z
CLASS:PUBLIC
CREATED:20120408T041113Z
DESCRIPTION:Testfghfghfghfghfghfghfghfghfghfghfghfghfghfghfgh
DTSTART;TZID=America/New_York:20120410T000000
DTEND;TZID=America/New_York:20120419T010000
LAST-MODIFIED:20120408T041228Z
LOCATION:Philadelphia\, PA
SEQUENCE:1
SUMMARY:Test
TRANSP:OPAQUE
Each line ends with (hex: 0D0A), which should be "\ r \ n".
The summary is called here:
$ this-> Summary = \ Extract \ Extract :: GetSummary ($ vevent);
And here is the function:
public static function GetSummary($String) {
$re1='.*?';
$re2='(SUMMARY)';
$re3='(:)';
$re4='(.*?)';
$re5='(\r\n)';
if ($c=preg_match_all ("/".$re1.$re2.$re3.$re4.$re5."/is", $String, $matches))
{
$word1=$matches[1][0];
$c1=$matches[2][0];
$word2=$matches[3][0];
return $word2;
}
}
Preg_match_all evaluates to true in my test file, but false in my program. Any ideas? Is there something about the raw string that he doesn't like, or is not copied to the test file (so I can't find it)?
source
share