Python·100 questions

How to work with regular expressions (re)?

Answer
re.search/findall/sub.
Compile the pattern: re.compile(pattern).
Use raw strings: r'\d+'.
Flags: re.I, re.M, re.S.
Don't complicate regex if it can be simpler.
Was this answer helpful?

More questions in this topic

Related questions from other topics