Regexp - Escape Character

Regexp

About

The escape character in a regular expression is the backslash.

It's needed when the regular expression want to design a meta characters in a regular expression.

It

  • takes away any special meaning that the meta characters may have.
  • applies both inside and outside character classes.

Example

For example, if you want to match:

  • the backslash itself, you write \\
  • a * character, you write \*

otherwise, they would be have be interpreted as meta-character

Php: Single and double quoted PHP strings have special meaning of backslash. Thus if \ has to be matched with a regular expression \\, then “\\\\” or '\\\\' must be used in PHP code.





Discover More
Regexp
Multilingual Regular Expression Syntax (Pattern)

Regular expression are Expression that defines a pattern in text. This is therefore a language that permits to define structure of a text. They are a mathematically-defined concept, invented by Stephen...
Regexp
Regexp - Backslash

Backslash is the general escape meta-character with several uses. It can: Stand for itself, Quote the next character, Introduce an operator, Do nothing see The third use of backslash...
Regexp
Regular Expression - Meta-(symbols|characters) - Operator

There are two different sets of meta-characters: those that are recognized anywhere in the pattern except within square brackets, and those that are recognized in square brackets. Operator...



Share this page:
Follow us:
Task Runner