开发者

Matching the first occurance of a number

In regex how would you match the number in the following string:

first_occurrence_85

Would: ([0-9][0-9]) do?

Edit: I meant to say any nu开发者_开发技巧mber of digits, so if its first_occurrence_8438, it should match 8438.


\d+ is enough.. \d matches with any digit..


How about this: ^.*[0-9]+.*$"
Will match any number of any character and after that atleast one numeric and then any number of any characters.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜