Sujet : Re: Correct syntax for pathological re.search()
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.pythonDate : 13. Oct 2024, 11:45:44
Autres entêtes
Organisation : Stefan Ram
Message-ID : <regex-20241013114449@ram.dialup.fu-berlin.de>
References : 1 2
Gilmeh Serda <
gilmeh.serda@nothing.here.invalid> wrote or quoted:
You don't need to escape the curly braces.
Here's the 411 on some gnarly regex characters:
. matches any single character, except when it hits a new line
^ kicks things off at the start of the sequence
$ wraps it up at the end
* goes zero to infinity
+ one or more times
? maybe once, maybe not
{ starts a specific count, like {2} or {2,3}
} ends such a count
| either this or that
\ flips the script on the next character's meaning
( drops in on a group
) bails out of the group
[ paddles out to a character class
] rides the character class to shore
.