From the course: NLP with Python for Machine Learning Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

What are regular expressions?

What are regular expressions? - Python Tutorial

From the course: NLP with Python for Machine Learning Essential Training

Start my 1-month free trial

What are regular expressions?

- [Presenter] Now that we know how to read in messy text, we want to learn some basics for how to manipulate, search for or split that text. So in this lesson we're going to cover some basics on regular expressions. If you're new to regular expressions, a regular expression, or a regex for short is a text string used for describing a certain search pattern. So if you're familiar with wildcards for search, like if you wanted to search for any CSV file on your computer using *.csv, this is basically just a supercharged version of that. Regular expressions can take various forms that we'll experiment with in the next lesson, but to give you a very quick example of what I mean, this regular expression will just just search for the explicit "nlp" string within some other string. This isn't so much a search pattern as it is an explicit command for what we want to find. So if it was, "I love nlp" then this search pattern would just capture and return "nlp." Another way to identify the "nlp"…

Contents