Course Content

If you are facing any issue in playing video please use Firefox browser.

Course Content


Python Regular Expression


In this lecture we will see that,

What is regular expression ?

What is match and search function ?

How to work with patterns in regular expression ?


A regular expression (regex or regexp for short) is a special text string for describing a search pattern. You can think of regular expressions as wildcards on steroids. You are probably familiar with the wildcard notations such as *.txt to find all text files in a file manager.


Match Function


This function determines if the RE matches at the beginning of the string.

Syntax :



pattern : This is the regular expression to be match.

string : This is a string which would be searched to match the pattern at the beginning of string.


Search Function


Scan through a string, looking for any location where this RE matches.

Syntax :,string)




Except for control characters ,(+?.*^$()[]{}|\), all characters match themselves. You can escape a control character by preceding it with a backslash.





Alteration, or the “or” operator.


Matches at the beginning of lines.


Matches at the end of a line.


Matches only at starting of string.


Matches only at ending of string.


Word boundary. This is zero-width assertion that matches only at the beginning or the end of the word.


Matches the word characters.


Matches the non word characters.


Matches digits.


Matches non digits.


Matches whitespaces.


Matches non whitespaces.


Another zero-width assertion, this is the opposite of \b, only matching when the current position is not at a word boundary.


Matches at least n and at most m occurrences of preceding expression.



Share With Friend

Have a friend to whom you would want to share this course?

Download The Apps

Code Scan or Download the app
Google Play Store
297K+ Downloads
4.5 Rating
10K+ Reviews
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere