Python Forum

Full Version: use of escape character in re.sub and find
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
python.org documentation here
and here for patterns.