# importing build in module regular expression, re module
import re
string = "search this inside of this text"
a = re.search("this", string)
print(a)
# <re.Match object; span=(7, 11), match='this'>
print(a.span()) # (7, 11)
print(a.start()) # 7
print(a.end()) # 11
pattern = re.compile("this")
b = pattern.search(string)
print(b)
# <re.Match object; span=(7, 11), match='this'>
c = pattern.findall(string)
print(c) # ['this', 'this']
d = pattern.match(string)
print(d) # None
string2 = "This is a text"
pattern2 = re.compile("This")
e = pattern2.match(string2)
print(e)
# <re.Match object; span=(0, 4), match='This'>
f = pattern2.fullmatch(string2)
print(f) # None
# https://regex101.com/
# https://www.w3schools.com/python/python_regex.asp
# https://www.programiz.com/python-programming/regex