When working with data, there is always the possibility of having to deal with text. Be prepared for when the time arrives, you will be finding, processing and dealing pretty well with alphanumeric strings, with the help of a powerful friend inside Python.

I am talking about REGEX. Regex stands for Regular Expression and it describes a special sequence of characters used to search and manipulate words, digits, or other characters in text strings.

This introductory piece of content aims to give you a nice approach to the subject and to provide you with some (more) preliminary knowledge thought as essential to get you familiarized with Regex.

Because Regex is so powerful, vast, and complex, I bet you will be also sharing the same perspective that an infinite number of pythonic-possibilities open up before us. Let’s take a look at some basic commands.

To begin with, besides Pandas, let’s import the re module, unlocking everything related to Regex in python.

import pandas as pd
import re

We also need to define a text on which we will be working on some examples throughout this article.

I selected a sentence written by Mat Velloso in a very curious attempt to distinguish between Machine Learning and Artificial Intelligence, in simple terms.

#regex #nlp #python #text #data-science

Best String Super Skills you must have: REGEX
2.90 GEEK