我有一個字符串是這樣的:把數字字符之前斷行字符串中使用PHP
123 qwerty 6 foo bar 55 bar
我需要像這樣
123 qwerty
6 foo bar
55 bar
如何製作的?
UPD: 我試圖讓它
$subject = "123 qwerty 6 foo 55 bar";
$pattern = '/[^0-9]/';
preg_match($pattern, substr($subject,3), $matches, PREG_OFFSET_CAPTURE);
echo "<pre>";
print_r($matches);
但它沒有爲我工作。
使用pregmatch功能 –
什麼'123 QWERTY 6 FOO 55 bar99x 1 abc'? bar99x會被打破,還是必須在空格後出現號碼? –
[你有什麼嘗試?](http://www.whathaveyoutried.com/)請參閱[FAQ]。 –