declare regex in python code example
Example 1: regex in python
# pip install regex
import re
# simple find all
sample = "Nothing lasts... but nothing is lost"
found = re.findall("thing", sample)
print(found)
Example 2: regex in python
>>> import re
>>> p = re.compile('ab*')
>>> p
re.compile('ab*')