开发者

How to retrieve data after the 1st occurence of a number/digit in a string in php

We have a query(mysql) which returns data in the following format of alphabets followed by digits followed by alphabets like -- text1 12.12 mg text2

Now the issue is , i need to write a script in php which gives all the data starting from the 1st digit.so the result should be something like

12.12开发者_Python百科 mg text2

I am not sure how to accomplish this in php and the functions which might be of use for this purpose. Any help would be appreciated.


preg_match('#\\d+(.*)$#', $message, $match);
$text = $match[1];

the \\d+ means one or more consecutive digits. (.*) means match any character except a new line. $ tells it to go to the end of the string...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜