Back to feed

Using Regular Expressions in Python

Real Python
Using Regular Expressions in Python

EDITOR BRIEF

The article introduces regex matching in Python with `re.search()`, which looks for a pattern in a string. It also covers metacharacters, groups, lookarounds, and flags for building more complex patterns.

INSIGHTS

Regexes help you find and inspect text efficiently. Try using `re.search()` to locate a simple pattern in a sample string, then add a group or flag.

CodeFriends courses that build on this story. Practice in the browser with nothing to install.

COMMENTS

0/40
0/2000

Loading comments…