我有一个在 PHP 中运行的简单正则表达式,由于某种原因,它不能与左括号一起使用。看:
$str = 'sdfsf sdfs<link rel="stylesheet" id="editor-buttons-css" href="http://localhost/wordpress/wp-includes/css/editor.min.css?ver=3.6" type="text/css" media="all">sdfsd sdfsdl';
$reg = '/<link[\s\S]+eet/';
preg_match($reg, $str, $re);
print_r($re);
// outputs: Array ( [0] => );
$str = 'sdfsf sdfs<link rel="stylesheet" id="editor-buttons-css" href="http://localhost/wordpress/wp-includes/css/editor.min.css?ver=3.6" type="text/css" media="all">sdfsd sdfsdl';
$reg = '/link[\s\S]+eet/';
preg_match($reg, $str, $re);
print_r($re);
// outputs: Array ( [0] => link rel="stylesheet );
如何让正则表达式与左括号一起使用?