Photo by s w on Unsplash

Useful Regex for Python Part I

Jeffrey Ng
2 min readDec 9, 2020

Hi, I chose to write this article because Regex (Regular Expression) is great knowledge and a great tool to possess in any computer science related role. It is used to match a pattern in a string. Its most widespread common application is in the search bar for search engines. Let us dive deeper in this library and come up with some useful cases of it that will make our coding lives much easier. This is the first of two blogs in a series, so let’s dig right in.

First we import the library:

import re

There is a lot of info, rules and syntax that one should be aware. It is these rules and syntax that make RE confusing and hard to apply. But all it takes is time and patience.

Like I said, RE is a large library and since my article is titled useful Regex, I will dig right into the parts of RE that would in my opinion make its application easier.

There are several modules in RE that I find particularly useful.

The discussion of these methods will be discussed in the second blog of this series.

Next, we will look at the characters.

And there you have some basic syntax and rules for RE. I found

to be comprehensive and thorough in referencing RE. The next installment in the series deals with methods and modules in RE. Stay tuned!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Jeffrey Ng
Jeffrey Ng

Written by Jeffrey Ng

Data Analyst | Lifelong Learner

No responses yet

Write a response