Skip to content

Commit db4e939

Browse files
committed
Use raw string literals for regexes containing backlash.
1 parent 4abda54 commit db4e939

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

β€ŽDoc/library/re.rstβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,9 +1230,9 @@ in each word of a sentence except for the first and last characters::
12301230
... random.shuffle(inner_word)
12311231
... return m.group(1) + "".join(inner_word) + m.group(3)
12321232
>>> text = "Professor Abdolmalek, please report your absences promptly."
1233-
>>> re.sub("(\w)(\w+)(\w)", repl, text)
1233+
>>> re.sub(r"(\w)(\w+)(\w)", repl, text)
12341234
'Poefsrosr Aealmlobdk, pslaee reorpt your abnseces plmrptoy.'
1235-
>>> re.sub("(\w)(\w+)(\w)", repl, text)
1235+
>>> re.sub(r"(\w)(\w+)(\w)", repl, text)
12361236
'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'
12371237

12381238

0 commit comments

Comments
 (0)