PHP regular expression (code) $ str = & lt; EODHTML... & lt; objectwidth = & quot; 425 & quot; height = & quot; 350 & quot; & gt; & lt; paramname = & q do not want to understand the PHP regular expression
[Code]
$ Str = < HTML...
HTML...
EOD;
$ Reg1 = '/ ] *> (.(?! $ Reg2 = '/ | [^>] +>)/S ';
$ Reg3 = '/ ] *> (.(?! | [^>] +>)/S ';
Preg_match ($ reg1, $ str, $ out1 );
Preg_match ($ reg2, $ str, $ out2 );
Preg_match ($ reg3, $ str, $ out3 );
Echo "$ str \ n
";
Print_r ($ out1 );
Print_r ($ out2 );
Print_r ($ out3 );
[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 = "350">
)
Array
(
)
[Problem]
Regular expression 1 and regular expression 2 match the first and second parts of the target string accurately and completely;
Regular Expression 3 is the integration of regular expression 1 and regular expression 2, but there is a problem and the content cannot be matched;
After trying for a long time, I cannot find any conflict between regular expression 1 and regular expression 2?
I only had 14 resource points, so I gave them all.
I don't know which expert can provide guidance?
------ Solution --------------------
$ Reg3 = '/
] *> (.(?!
| [^>] +>)/S ';