Rodrigo Girão Serrão 🐍🚀 @mathspp.com · Jan 16

A regex match has the method `groups`. This method returns a tuple with all of the groups that the pattern contained. Here's an example 👇

0 likes 2 replies

?

Replies

@valeknappich.bsky.social · Jan 17

That multi-line pattern only works with re.X, right?

Rodrigo Girão Serrão 🐍🚀 · Jan 16

Suppose I have a pattern for numbers with an optional decimal point and optional decimal digits: ```py import re pattern = r"""(?x) (\d+) # 1 or more digits \.? # An optional . (\d+)? # More optional digits """ m = re.match(pattern, "24.5") ```