- end() used in regular expression in python, which find the end index value of the match pattern in the string.
Syntax-
x=re.search(pattern,string)
x.end()
Example-
string is s="This is string"
x=re.search('is',s)
x.end() will return 7
program-
#import the re module
import re
#Given string is
str = "What is programming language"
#upper index value of 'is'
x = re.search('is', str)
print(x.end())
#upper index value of 'in'
x = re.search('in', str)
print(x.end())
#upper index value of 'program'
x = re.search('program', str)
print(x.end())
7
18
15