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.
精彩评论