質問

I have several log files that contain EPP requests and responses. I need to use preg_match_all to return an array of all the XML requests within the log, so I can then parse out the XML and validate it, however I'm not too familiar with regex. The XML should always begin with...

<?xml

...and end with...

</epp>

How would I form Regex to find everything contained between and including these identifiers.

役に立ちましたか?

解決

You should use s flag in which . matches new lines as well, and a whole capture group:

preg_match_all("/(<\?xml.*?<\/epp>)/s", $content, $matches);
print_r($matches[1]);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top