我有以下字符串:
12345 This could be anythingREMOVE
我需要匹配12345和This could be anything。不幸的是,我需要解析的格式在行尾也有一个并不总是存在的字符串(REMOVE在这个例子中)。如果没有 ,我如何匹配我正在寻找的东西REMOVE?我尝试了以下模式:
^(\d{5}) (.*)(?:REMOVE|$)
不幸的是,REMOVE被通配符选中:
(
[0] => Array
(
[0] => 12345 This could be anythingREMOVE
)
[1] => Array
(
[0] => 12345
)
[2] => Array
(
[0] => This could be anythingREMOVE
)
)