Obtain the matched characters in the Href attribute of A tag. For more information, see <divclass = & quot; a & quot; herf = & quot; regular match.
Obtain the Href attribute of A tag
Matched characters
Connection 1
Connection 2
Connection 3
You can use single quotes without quotation marks, but you cannot use either of them.
PHP code
preg_match('//i', $str, $matches)
Why not?
------ Solution --------------------
PHP code
$ Str = <
] *>/', $ Str, $ matches); print_r ($ matches [2]);
------ Solution --------------------
PHP code
$ Str = <
------ Solution --------------------
PHP code
[User: root Time: 14: 14: 52 Path:/home/liangdong/php] $ php preg. php Array ([0] => Array ([0] => Array ([0] => "[1] => '[2] =>) [2] => Array ([0] => http://www.baidu.com/[1] => http://www.baidu.com/[2] => http://www.baidu.com/) [User: root Time: 14: 14: 53 Path:/home/liangdong/php] $ cat preg. php