python regex match number code example
Example 1: python regex numbers only
import re
re.compile(r'[/d]+')
# /d refers to any digit
# use other regex patters for ore modifcations
# This can extract the numbers from the regex
Example 2: python re compile
import re
# Compile a regular expression pattern into a regular expression object, which can be used for matching using its match(), search() and other methods, described below.
prog = re.compile(pattern)
result = prog.match(string)
# is equivalent to
result = re.match(pattern, string)