regex for substring python code example
Example 1: extract text regex python
>>> import re
>>> re.findall(r'\d{1,5}','gfgfdAAA1234ZZZuijjk')
>>> ['1234']
Example 2: find and replace subword in word python regex
result = re.sub(r"Pulp Fiction", "Forrest Gump", text)