1. Help Center
  2. Build
  3. Regular Expressions (Regex)

Escaping

The concept of escaping is one that is used throughout computer languages. When you escape a character, you place a pre-determined character (the escape character) before it. This tells the application interpreting the regex that the very next character, usually a special character or metacharacter in regex, is to be treated as a literal character and not as a special character.

Note: Some literal characters when escaped take on a special meaning in regex. This is an advanced case not covered in this guide.

The following is an example of what an escaped character looks like:

\?

In this regex, the backslash is the escape character and the question mark is the character being escaped. The backslash is essentially saying, "The following character is not a special character; it is just a question mark of the sort that may appear at the end of a question."

When the character is not preceded by a backslash, regex interprets it with its special meaning within the group of regex special characters. In order to tell regex to interpret the "?" as a literal question mark, you place the backslash before it, or you escape it.

Special Characters

Regex makes use of the following special characters to interpret patterns of text:

. ? * + ^ | $ \ ( ) [ ] { }

If you want use one of these characters as a literal character, you must escape it by placing a backslash before it as follows:

\. \? \* \+ \^ \| \$ \\ \( \) \[ \] \{ \}

SiteSpect's Escaper Tool

In general, you can perform all of the basic Find or Find and Replace functions of a standard editor's search tool in SiteSpect without learning regular expressions. Enter the literal text (the precise text you want to find, such as "Sign in" or "mysite.com") and then use the Escaper tool (ICON-Escaper) within that field to automatically replace any characters that have special meanings in regex with their escaped counterparts. This means that it inserts any necessary backslashes to indicate that the character that follows the blackslash should be interpreted literally and not with its special meaning in regex.