$str="&%*&^h-e_l_lo*&^*&";
怎么拆分成
$left="&%*&^";//until the first A-Za-z character
$right="*&^*&";//right after the last A-Za-z character
$middle = "h-e_l_lo";
我找到了这种找到 $left 的方法,但我怀疑这是最好的方法:
$curr_word = "&%*&^h-e_l_lo*&^*&";
preg_match('~[a-z]~i', $curr_word, $match, PREG_OFFSET_CAPTURE);
$left = substr($curr_word, 0,$match[0][1]);// &%*&^