P R O F. A R C H A N A TA M I Z H A R A S A N
,REGULAR EXPRESSION
• Regular expression is a sequence of character(s) mainly used to find
and replace patterns in a string or file.
• Regular expressions use two types of characters:
a) Meta characters:
characters having a special meaning
b) Literals (like a,b,1,2…)
– regular expression is a sequence of character(s) mainly used to find and
replace patterns in a string or file.
– Use this code : Import re
,USAGE
• The most common uses of regular expressions are:
– Search a string (search and match)
– Finding a string (findall)
– Break string into a sub strings (split)
– Replace part of a string (sub)
, RE -PACKAGE
• The ‘re’ package provides multiple methods to perform queries on
an input string. Here are the most commonly used methods are:
• 1. re.match()
• 2. re.search()
• 3. re.findall()
• 4. re.split()
• 5. re.sub()
• 6. re.compile()
,REGULAR EXPRESSION
• Regular expression is a sequence of character(s) mainly used to find
and replace patterns in a string or file.
• Regular expressions use two types of characters:
a) Meta characters:
characters having a special meaning
b) Literals (like a,b,1,2…)
– regular expression is a sequence of character(s) mainly used to find and
replace patterns in a string or file.
– Use this code : Import re
,USAGE
• The most common uses of regular expressions are:
– Search a string (search and match)
– Finding a string (findall)
– Break string into a sub strings (split)
– Replace part of a string (sub)
, RE -PACKAGE
• The ‘re’ package provides multiple methods to perform queries on
an input string. Here are the most commonly used methods are:
• 1. re.match()
• 2. re.search()
• 3. re.findall()
• 4. re.split()
• 5. re.sub()
• 6. re.compile()