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