小编del*_*er2的帖子

正则表达式在第一个换行符时分割字符串

我想在第一个换行符处拆分一个字符串,而不是第一个空白行

' /^(.*?)\r?\n\r?\n(.*)/s'(第一个空白行)

例如,如果我有:

$ str ='2099 test \n你确定要继续\n其他字符串在这里......';

match[1] = '2099 test'
match[2] = 'Are you sure you want to continue\n some other string here...'
Run Code Online (Sandbox Code Playgroud)

php regex

5
推荐指数
3
解决办法
4974
查看次数

标签 统计

php ×1

regex ×1