Object Match consist of all information about searching and the result and if it is not found the match then None will be returned. Let’s see some of methods and common attributes that is used from matches’ object.

import re

s = "Greeting to MYSKILL PORTAL"

# here x is the match object
res = re.search(r"\\bg", s)

print(res.re)
print(res.string)
re.compile('\\\\bG')
Greeting to MYSKILL PORTAL

Attributes match.re returned regular expression that is passed through and attribute match.string returns string that is passed through

import re

s = "Welcome to SeedsLand"

# here x is the match object
res = re.search(r"\\bSee", s)

print(res.start())
print(res.end())
print(res.span())
11
14
(11, 14)