Get to Know Regex for Finding Substrings
00:00 Now you’ve done some good substring-finding in your text, but your requirements have gone up a bit. So you want to know more about the substring, and you want to have more flexibility in matching a specific substring.
00:15
And if you want to match with conditions, then you want to use Python’s re
module. This is built in, so it comes with the standard library, which means you just need to import re
, and then you’re ready to work with regular expressions in Python.
00:32 Regex stands for regular expressions, and these are patterns that are used in computer programming to match and manipulate text. They provide a concise and powerful way to search, replace, and extract specific patterns of text from strings.
00:46
And more resources come at the end of this lesson if you really want to dive deeper into this topic, which is a pretty deep topic. In this part of the course, you’re going to learn how to do that, and specifically, you’re going to look at re.search()
, re.findall()
, and re.finditer()
.
01:06 And I’m going to show you examples of using these functions with the text that you worked with before so that you can get a feeling of what you can do with them.
01:16 And to end this lesson, here’s a quick recap. Regex stands for regular expressions. Regular expressions are patterns that you can use to match and manipulate text, and you’ll see them in action now, but there will be links to more resources at the end of this course section.
Become a Member to join the conversation.