获取一个A标签的Href属性
被匹配的字符
连接1
连接2
连接3
可以没有引号 可以有双引号 单引号 但是不允许一侧有引号另一侧没有引号
- PHP code
preg_match('//i', $str, $matches)
这样怎么不行呢
------解决方案--------------------
- PHP code
$str=<<]*>/',$str,$matches); print_r($matches[2]);
------解决方案--------------------
PHP code
$str=<<------解决方案--------------------
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