Photo by s w on Unsplash

Useful Regex for Python Part I

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!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store