Solution
In order to match a pattern that includes the backslash character (
\) or other special symbols or characters, you will want to look at the
Special Characters for Match Pattern help page for how to work with each special character. Specifically for backslashes, you will need to escape the backslash first, meaning to match the string
\r, you will need to put in the pattern as
\\r. If you only put in
\r, you will end up matching for the non-print carriage return that is represented by
\r.