PHP Regular issues that you don't understand
Code
$str = << <>
Html...
Html...
EOD;
$reg 1 = '/ ]*> (. (?!
$reg 2 = '/ | [^>]+>)/s ';
$reg 3 = '/ ]*> (. (?! | [^>]+>)/s ';
Preg_match ($reg 1, $str, $out 1);
Preg_match ($reg 2, $str, $out 2);
Preg_match ($reg 3, $str, $out 3);
echo "$str \n\n\n
";
Print_r ($out 1);
Print_r ($out 2);
Print_r ($out 3);
Output
Html...
Html...
Array
(
[0] =
[1] =
)
Array
(
[0] = [1] = src=" Http://www.atungm.com/v/AyPzM5WK8ys "type=" Application/x-shockwave-flash "wmode=" Transparent "width=" 425 "height=";
)
Array
(
)
"problem"
Regular expression 1, The regular expression 2 is accurately and completely matched to the front and back of the target string, the
Regular Expression 3 is the regular expression 1, the regular expression 2 of the integration, but there is a problem, matching is not content;
tried for a long time can not find, regular expression 1, regular expression 2 What is the conflict between?
I only have 14 points of resources, and all of them are so much.
do not know which Master can guide?
------Solution--------------------
$reg 3= '/
]*> (. (?!
|
[^>]+>)/s ';