in python you use Regular Expressions then first import re modules

The special characters are:

"." Matches any character except a newline.
"^" Matches the start of the string.
"$" Matches the end of the string or just before the newline at the end of the string.
"*" Matches 0 or more occurrences
"+" Matches 1 or more occurrences.
"?" Matches 0 or 1 occurrences.
*?,+?,?? Non-greedy versions of the previous three special characters.
{m,n} Matches from m to n repetitions of the preceding RE.
{m,n}? Non-greedy version of the above.
"\\" Either escapes special characters or signals a special sequence.
[] Indicates a set of characters.A "^" as the first character indicates a complementing set.
"|" A|B, creates an RE that will match either A or B.
(...) Matches the RE inside the parentheses.The contents can be retrieved or matched later in the string.
(?aiLmsux) Set the A, I, L, M, S, U, or X flag for the RE (see below).
(?:...) Non-grouping version of regular parentheses.
(?P...) The substring matched by the group is accessible by name.
(?P=name) Matches the text matched earlier by the group named name.
(?#...) A comment; ignored.
(?=...) Matches if ... matches next, but doesn't consume the string.
(?!...) Matches if ... doesn't match next.
(?<=...) Matches if preceded by ... (must be fixed length).

This module exports the following functions:

match Match a regular expression pattern to the beginning of a string.
search Search a string for the presence of a pattern.
findall Find all occurrences of a pattern in a string.

match() function in python:it find only starting String first charecter or word

import re
def getRegularExpressions():
	searchKeyword=input("Enter the Search keyword :")
	se=re.match(searchKeyword,"I'm not a great programmer; I'm just a good programmer with great habits.")
	print(se)
getRegularExpressions() 
Enter the Search keyword :I'm

If you want print if search keyword match then use group() method

import re
def getRegularExpressions():
	searchKeyword=input("Enter the Search keyword :")
	se=re.match(searchKeyword,"I'm not a great programmer; I'm just a good programmer with great habits.")
	print(se.group())
getRegularExpressions() 
Enter the Search keyword :I'm
I'm

If you want print if search keyword match starting and ending index then use start() and end() method

import re
def getRegularExpressions():
	searchKeyword=input("Enter the Search keyword :")
	se=re.match(searchKeyword,"I'm not a great programmer; I'm just a good programmer with great habits.")
	print(se.start()," ",se.end())
getRegularExpressions() 
Enter the Search keyword :I'm
0   3

span() method also print starting and ending index in tuple form

import re
def getRegularExpressions():
	searchKeyword=input("Enter the Search keyword :")
	se=re.match(searchKeyword,"I'm not a great programmer; I'm just a good programmer with great habits.")
	print(se.span())
getRegularExpressions() 
Enter the Search keyword :I'm
(0, 3)

If search keyword not match.It return None

import re
def getRegularExpressions():
	searchKeyword=input("Enter the Search keyword :")
	se=re.match(searchKeyword,"I'm not a great programmer; I'm just a good programmer with great habits.")
	print(se)
getRegularExpressions() 
Enter the Search keyword :ashu
None

search() function in python:it find enteriar String character or word only first occurrences.

import re
def getRegularExpressions():
	searchKeyword=input("Enter the Search keyword :")
	se=re.search(searchKeyword,"I'm not a great programmer; I'm just a good programmer with great habits.")
	print(se)
getRegularExpressions() 
Enter the Search keyword :programmer

If you want print if search keyword match then use group() method

import re
def getRegularExpressions():
	searchKeyword=input("Enter the Search keyword :")
	se=re.search(searchKeyword,"I'm not a great programmer; I'm just a good programmer with great habits.")
	print(se.group())
getRegularExpressions()
Enter the Search keyword :programmer
programmer

If you want print if search keyword match starting and ending index then use start() and end() method

import re
def getRegularExpressions():
	searchKeyword=input("Enter the Search keyword :")
	se=re.search(searchKeyword,"I'm not a great programmer; I'm just a good programmer with great habits.")
	print(se.start(),"  ",se.end())
getRegularExpressions() 	
Enter the Search keyword :programmer
16    26

span() method also print starting and ending index in tuple form

import re
def getRegularExpressions():
	searchKeyword=input("Enter the Search keyword :")
	se=re.search(searchKeyword,"I'm not a great programmer; I'm just a good programmer with great habits.")
	print(se.span())
getRegularExpressions() 
Enter the Search keyword :programmer
(16, 26)

If search keyword not match.It return None

import re
def getRegularExpressions():
	searchKeyword=input("Enter the Search keyword :")
	se=re.search(searchKeyword,"I'm not a great programmer; I'm just a good programmer with great habits.")
	print(se)
getRegularExpressions() 	
Enter the Search keyword :ashu
None

findall() function in python:it find enteriar String charecter or word.if word charecter or word match then return in list format

import re
def getRegularExpressions():
	searchKeyword=input("Enter the Search keyword :")
	se=re.findall(searchKeyword,"I'm not a great programmer; I'm just a good programmer with great habits.")
	print(se)
getRegularExpressions() 
Enter the Search keyword :programmer
['programmer', 'programmer']
import re
def getRegularExpressions():
	print(re.match("[abc]","abc"))
	print(re.match("[abc]","bca"))
	print(re.match("[abc]","cab"))
	print(re.match("[a-z]","aaaa"))
	print(re.match("[0-9]","111"))
	print(re.match("[123]","333"))
getRegularExpressions()






import re
def getRegularExpressions():
	print(re.match("[abc]*",""))
	print(re.match("[abc]*","."))
	print(re.match("[abc]*","xyz"))
	print(re.match("[abc]*","cab"))
	print(re.match("[a-z]*","aaaa"))
	print(re.match("[0-9]*","111"))
	print(re.match("[123]*","333"))
getRegularExpressions()






import re
def getRegularExpressions():
	print(re.match("[abc]+",""))
	print(re.match("[abc]+","."))
	print(re.match("[abc]+","xyz"))
	print(re.match("[abc]+","cab"))
	print(re.match("[a-z]+","aaaa"))
	print(re.match("[0-9]+","111"))
	print(re.match("[123]+","333"))
getRegularExpressions()
None
None
None




import re
def getRegularExpressions():
	print(re.match("[abc]?",""))
	print(re.match("[abc]?","."))
	print(re.match("[abc]?","xyz"))
	print(re.match("[abc]?","cab"))
	print(re.match("[a-z]?","aaaa"))
	print(re.match("[0-9]?","111"))
	print(re.match("[123]?","333"))
getRegularExpressions()