warming up your workspace

Regular expression

Applies to: general, python

A regular expression is a pattern that matches sets of strings, used for searching, validating, and extracting text. It is powerful for structured patterns but a poor fit for nested or recursive formats like HTML.

import re
re.findall(r"\d+", "a12 b3")   # ['12', '3']

See also: string, parsing