我正在尝试使用以下代码提取字符串:
$item = 'id="firstname" l="Prénom" n="firstname" t="text" v=""';
preg_match_all('#(?:l|label|lbl)\s*=\s*"([\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}\x{00C6}\x{00C7}\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{00CC}\x{00CD}\x{00CE}\x{00CF}\x{00D0}\x{00D1}\x{00D2}\x{00D3}\x{00D4}\x{00D5}\x{00D6}\x{00D7}\x{00D8}\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{00DD}\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}\x{00E6}\x{00E7}\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{00EC}\x{00ED}\x{00EE}\x{00EF}\x{00F0}\x{00F1}\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{00FD}\x{00FF}\sa-zA-Z0-9_-]+)"#is', $item, $m);
使用像“firstname”这样的非unicode字符串时工作正常,但当 $ item 包含“Prénom”
等字符串时返回空值知道为什么吗?
答案 0 :(得分:1)
只需将u
添加到修改器列表中:isu
。