如何在php中的preg_match_all()中添加印地语字符搜索?
我们可以知道它是为像 if(preg_match_all(“/something/”,$any,$match)如何在php中的preg_match_all()中添加印地语字符搜索?,php,regex,preg-match-all,Php,Regex,Preg Match All,我们可以知道它是为像 if(preg_match_all(“/something/”,$any,$match) 但是我们也可以使用印地语字符吗?我已经在代码中使用了它 /[^\p{Zs}\p{P}]*?ह[^\p{Zs}\p{P}]*/u 修饰符/u用于unicode支持 对于您的代码如下所示 $any = 'तरह के लाभ मिलते हैं'; $searchword = 'ह'; preg_match_all('/[^\p{Zs}\p{P}]*?'.$searchword.'[
但是我们也可以使用印地语字符吗?我已经在代码中使用了它
/[^\p{Zs}\p{P}]*?ह[^\p{Zs}\p{P}]*/u
修饰符/u
用于unicode支持
对于您的代码如下所示
$any = 'तरह के लाभ मिलते हैं';
$searchword = 'ह';
preg_match_all('/[^\p{Zs}\p{P}]*?'.$searchword.'[^\p{Zs}\p{P}]*/u', $any, $match);
print_r($match);
输出将为:
Array
(
[0] => Array
(
[0] => तरह
[1] => हैं
)
)
如果我需要英语和印地语两种语言字符,如“英语字符,印地语字符”,在这种情况下,我如何执行正则表达式??