Python Tutorial: re Module – How to Write and Match Regular Expressions (Regex)


Video is ready, Click Here to View ×

In this Python Programming Tutorial, we will be learning how to read, write, and match regular expressions with the re module. Regular expressions are extremely useful for matching common patterns of text such as email addresses, phone numbers, URLs, etc. Learning how to do this within Python will allow us to quickly parse files and text for the information we need. Let’s get started…

The code from this video can be found…

27 thoughts on “Python Tutorial: re Module – How to Write and Match Regular Expressions (Regex)

  1. Corey, your videos are awesome, they cover more than the basics and are explained in a crystal clear way. If I could make a single suggestion it would be to run your codes using the Jupyter notebook. It would be easier to follow and perhaps easier for you to explain. For example, you could write down beforehand the topics in markdown and keep coding according to the topics described beforehand. Thanks anyway for the amazing videos.

  2. Hello, Thanks for the wonderful tutorial. Can you please help me with this expression…I am unable to comprehend it.

    s = "one two 3.4 5,6 seven.eight nine,ten"

    parts = re.split('s|(?<!d)[,.](?!d)', s)


  3. For some reason the conditional isn't working like in the video.
    I'm typing it in exactly, but only the Mr. Ms or Mrs beginning characters are showing. When I remove the conditional and try the beginnings individually they all work.

Leave a Reply

Your email address will not be published. Required fields are marked *