PHP regular expression problem Array
(
[Description] => HTTP/1.1 200 OK
Set-Cookie: JSESSIONID = 40ea513defae87d424eacb79c4e8a1b5; Path =/ipcam
Content-Type: text/xml; charset = UTF-8
Transfer-Encoding: chunked
Date: Thu, 27 Jun 2013 01:08:23 GMT
Server: Apache-Coyote/1.1
C1b
1.0
GBK
UserLogin
244ab25cf7f0258401c2ae0b038ead0a
0
}
This is the original string. I want to extract the xml string. do you want to compress it to write the regular expression? what you write is always empty and cannot be compiled.
The result should be:
1.0
GBK
UserLogin
244ab25cf7f0258401c2ae0b038ead0a
Reply to discussion (solution)
So how did you write it?
So how did you write it?
All the regular expressions I write can only retrieve the data of one row, for example, the data of the first row of xml:
'/\ <\?. *\? \> /'
However, if I cannot retrieve multiple lines of xml data, for example:
'/\ <\? Xml. * Envelope \> /'
$preg='/<\?xml version\="1\.0" encoding\="UTF\-8" \?>(.*?)\}/ius';preg_match_all($preg, $str, $lined);print_r($lined);
Let's look at the rest. remember not to miss the ius, otherwise it will be blank. The latter is case insensitive and multi-row mode matching.
So how did you write it?
All the regular expressions I write can only retrieve the data of one row, for example, the data of the first row of xml:
'/\ <\?. *\? \> /'
However, if I cannot retrieve multiple lines of xml data, for example:
'/\ <\? Xml. * Envelope \> /'
You can also
$preg='/\<\?xml.*Envelope\>/ius';preg_match_all($preg, $str, $lined);print_r($lined);
View results by yourself
The key is that the following ius multi-row matching mode is case insensitive.
The key is that the following ius multi-row matching mode is case insensitive.
Master. Thanks to the moderators.