I'm trying to extract some text in between a Request XML tag (between and tags) using this Regex:
(?<=(<Request>)).*(?=(</Request>))
RegexBuddy shows me that it's fine, but preg_match returns this error: "Unknown modifier R". Placing a backslash before the "/" makes it so nothing returns. Does anyone know what the problem is?
Code:
$parsedQuery = fopen("c:\\query", "r") ;
$parsed ="".
while (!feof($parsedQuery)) {
$parsed .= fgets($parsedQuery) ;}
$reg = "#(?<=(<Request>)).*(?=(</Request>))#";
$match = array();
preg_match($reg, $parsed, $match);
print_r($match);
Edit: I now noticed that the file opens with an unidentified character (binary value is 3F) after the opening of each tag (the "<" character). I assume php's fgets implementation does this for security measures, could this be the problem, and is there any way to surpass it?