我想搜索/允许字符和空白。这适用于ANSI/LATIN-1字符:
$pattern = '#<a ['W'w]* href="1"#i';
我试过这个,但显然它不起作用:
mb_internal_encoding('UTF-8');
mb_regex_encoding("UTF-8");
$pattern = '/<a['pLN'W]* href="1"/ui';
用这个代替
$pattern = '~<a ['pL's]*'bhref="1"~ui';
<a #begin with a tag + a space
['pL's]* # zero or more unicode letters or blank characters (space newline tab)
'bhref="1" # href="1" not preceded by a letter or a number
ui # modifier u for unicode string, i case insensitive