python regex find digits in string code example
Example 1: python extract all numbers from string re
>>> str = "h3110 23 cat 444.4 rabbit 11 2 dog"
>>> [int(s) for s in str.split() if s.isdigit()]
[23, 11, 2]
Example 2: regex for digits python
[0-9] is not always equivalent to \d. In python3, [0-9] matches only
0123456789 characters, while \d matches [0-9] and other digit characters,
for example Eastern Arabic numerals.