From today's class:

import re
s = 'abbcccddddeeeee'
re.findall('d{1, 4}', s)


[ ]

Why? Because of the space before the 4!

I've been teaching for years, and never knew that {min,max} cared about whitespace before/after the comma.


Sign in to participate in the conversation
Mastodon Bayern

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!