Regex

How to Match an Exact Word in Python Regex? (Answer: Don’t)

This morning, I read over an actual Quora thread with this precise question. While there’s no dumb question, the question reveals that there may be some gap in understanding the basics in Python and Python’s regular expression library. So if you’re an impatient person, here’s the short answer: How to match an exact word/string using …

How to Match an Exact Word in Python Regex? (Answer: Don’t) Read More »

What are Regular Expressions Used For? 10 Applications

The web is full of tutorials about regular expressions. But I realized that most of those tutorials lack a thorough motivation. Why do regular expressions exist? What are they used for? What are some practical applications? Somehow, the writers of those tutorials believe that readers are motivated by default to learn a technology that’s complicated …

What are Regular Expressions Used For? 10 Applications Read More »

Python Re Groups

This tutorial explains everything you need to know about matching groups in Python’s re package for regular expressions. You may have also read the term “capture groups” which points to the same concept. As you read through the tutorial, you can also watch the tutorial video where I explain everything in a simple way: Related …

Python Re Groups Read More »

Python Regex And Operator [Tutorial + Video]

This tutorial is all about the AND operator of Python’s re library. You may ask: what? (And rightly so.) Sure, there’s the OR operator (example: ‘iPhone|iPad’). But what’s the meaning of matching one regular expression AND another? There are different interpretations for the AND operator in a regular expression (regex): Ordered: Match one regex pattern after …

Python Regex And Operator [Tutorial + Video] Read More »