Python Forum
use of escape character in re.sub and find - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: use of escape character in re.sub and find (/thread-39430.html)



use of escape character in re.sub and find - WJSwan - Feb-16-2023

Where can I find documentation so that I can learn how to use escape characters in re.sub and with find method correctly?

I tend to find that I always do this by trial and error. I am never sure when to just use "\\" and when to use "\\\\" and how to properly apply the r in front of a pattern.


RE: use of escape character in re.sub and find - Larz60+ - Feb-16-2023

python.org documentation here
and here for patterns.