2017-02-23 47 views

回答

1

您可以使用下面的正則表達式模式選擇字符串:

(.*?)(?:\sas\s)(.*?)$ 

input  >> abc.id as od 
regex search >> (.*?)(?:\sas\s)(.*?)$ 
replace with >> $1$2 
output  >> abc.idod 

看到demo/explanation

PHP

$re = '/(.*?)(?:\sas\s)(.*?)$/'; 
$str = 'abc.id as od'; 
$subst = '$1$2'; 
$result = preg_replace($re, $subst, $str); 
echo $result; 
+0

謝謝你救了我整整一天。 –

相關問題