我有一个顺序相同的数据表,如下所示
123.- sumi hai
bla
124.- the
secod line
is blah
125.- another line
我试图用php preg_replace()得到类似这样的东西。
123.- sumi hai blah
124.- the second line is blah
125.- another line
请帮我提前谢谢
发布于 2018-06-04 03:33:04
您可以像这样使用正则表达式:
\n^(?=[a-z])
$str = '123.- sumi hai
bla
124.- the
secod line
is blah
125.- another line';
$result = preg_replace('/\n^(?=[a-z])/m', ' ', $str);
echo "The result of the substitution is ".$result;
https://stackoverflow.com/questions/50670211
复制相似问题