正则匹配制定字符
匹配字符:
$str = '<div class="location area">
<span class="sohu-logo"><a href="/">{{ __("Sohu") }}</a>';
$preg2 = '/__([^\s*]*)/i';
preg_match_all($preg2, $str, $matches);
dd($matches);
执行结果:
array:2 [▼
0 => array:5 [▼
0 => "__("Sohu")"
1 => "__("南国早报")"
2 => "__("文章")"
3 => "__("总阅读")"
4 => "__("查看TA的文章")"
]