Reputation: 466
Input
abc-preview-check-random-post-5.500.510-5009
abc-preview-check-random-post-2.15.510-50098709
Expected output:
5.500.510-5009
2.15.510-50098709
I tried [^a-zA-z]
but its matching the dashes as well.
Upvotes: 0
Views: 34
Reputation: 6057
A working regex could be: \d.*$
import re
p = re.compile('\d.*$')
p.findall("abc-preview-check-random-post-5.500.510-5009")
# ['5.500.510-5009']
p.findall("abc-preview-check-random-post-2.15.510-50098709")
# ['2.15.510-50098709']
Upvotes: 1