Escaping Regular Expression Sequences

When searching using regular expressions it is sometimes necessary to escape character sequences. Escaping a character sequence is performed using the backslash character.

 

For example, given the following example:

 

A sample block of text that contains a (string).

 

If we wanted to search for the string (string) we would need to escape the ( and ) characters because they are special regular expression sequences used to create a grouping region. To match the string we must escape the special sequences. Our search string would become:

 

\(mystring\)

 

In this case our expression would match the following:

 

A sample block of text that contains a (string).

 

 

Back: End of Line Sequence

Forward: Regular Expression Search Examples