Problem Statement
Why use raw strings like r"\d+" for regex patterns?
Explanation
Raw strings treat backslashes as literal characters so regex escapes remain intact. This avoids accidental Python escape sequences.
It improves readability and prevents common mistakes like using "\n" when you meant backslash and n.
Code Solution
SolutionRead Only
pattern = re.compile(r'\d{4}-\d{2}-\d{2}')Practice Sets
This question appears in the following practice sets:
