PHP 正则表达式
/
\B
匹配 ( 非单词 )边界
<?php
//字符串
$str = 'a_b c _ d';
//正则表达式
$regular = '/\B_\B/';
//执行匹配正则表达式
preg_match_all($regular, $str, $matches);
//打印结果
echo '<pre>';
print_r($matches);
echo '</pre>';
输出结果
Array
(
[0] => Array
(
[0] => _
)
)
本文章首发在 LearnKu.com 网站上。
推荐文章: