I'm trying to understand the backslash and how to use escaping like:
escape a string
Many characters in regular expressions have special meanings. For instance, the dot character '.' means "any one character". There are a great deal of these specially-defined characters, and sometimes, you want to search for one, not use it's special meaning.
See this example to search for any filename that contains a '.':
In the example, there are 3 dots, but our description says that we're only looking for one. Let's break it down by the dots:
So, the backslash is used to "escape" the character immediately following it; as such, it's called the "escape character". That just means that the character's special meaning is taken away in that one place.
Now, escaping a string (in regex terms) means finding all of the characters with special meaning and putting a backslash in front of them, including in front of other backslash characters. When you've done this one time on the string, you have officially "escaped the string".