Regex Flashcards
1
Q
Explain the meaning of the quantifiers: *, +, ?, {}
A
- : 0 or many
+ : 1 or many
? : 0 or 1
{n} : n times
2
Q
What does the wildcard do? What is its symbol?
A
. : any character is matched
3
Q
Explain how groups work, and how to implement them?
A
(aa|bb) matches aa or bb
4
Q
What does the following statement mean: [a-z0-9]*
A
lowercase letters or digits, 0 or many
5
Q
What does the ^ mean in [^a]
A
anything but a
6
Q
How would you get your matches as an iterable?
A
p = re.compile(‘[…]’)
p.finditer(document)