diff options
author | Georg Brandl <georg@python.org> | 2010-07-12 09:06:13 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-07-12 09:06:13 (GMT) |
commit | db4e939206e17c0932a177d186462c8f69f22903 (patch) | |
tree | 52b6910aced344afcf669396b01e0382f80751fc | |
parent | 4abda5488913bee68c83bb00ae1812f99a013b93 (diff) | |
download | cpython-db4e939206e17c0932a177d186462c8f69f22903.zip cpython-db4e939206e17c0932a177d186462c8f69f22903.tar.gz cpython-db4e939206e17c0932a177d186462c8f69f22903.tar.bz2 |
Use raw string literals for regexes containing backlash.
-rw-r--r-- | Doc/library/re.rst | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 7873fa8..26a5f52 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -1230,9 +1230,9 @@ in each word of a sentence except for the first and last characters:: ... random.shuffle(inner_word) ... return m.group(1) + "".join(inner_word) + m.group(3) >>> text = "Professor Abdolmalek, please report your absences promptly." - >>> re.sub("(\w)(\w+)(\w)", repl, text) + >>> re.sub(r"(\w)(\w+)(\w)", repl, text) 'Poefsrosr Aealmlobdk, pslaee reorpt your abnseces plmrptoy.' - >>> re.sub("(\w)(\w+)(\w)", repl, text) + >>> re.sub(r"(\w)(\w+)(\w)", repl, text) 'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.' |