From 63301d61ecedc41695098045ec0ed8466d260399 Mon Sep 17 00:00:00 2001 From: Zeeshan Ahmed Date: Mon, 24 Jul 2017 10:33:42 +0100 Subject: [PATCH] Add escaping special character --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 4b7e921..3db1701 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ contains uppercase letter and also it is too short. - [The Question Mark]() - [Character Group]() - [Alternation]() + - [Escaping special character]() - [Quantifiers]() - [OR operator]() - [Character Sets]() @@ -202,4 +203,16 @@ or lowercase character `c`, followed by lowercase character `a`, followed by low
 "[T|t]he|car" => The car is parked in the garage.
+
+ +## 2.6 Escaping special character + +Backslash `\` is used in regular expression to escape the next character. This allows to to specify a symbol as a matching character +including reserved characters `{ } [ ] / \ + * . $ ^ | ?`. To use a special character as a matching character prepend `\` before it. +For example the regular expression `.` is used to match any character except new line. Now to match `.` in an input string the regular +expression `[f|c|m]at\.?` means: lowercase letter `f`, `c` or `m`, followed by lowercase character `a`, followed by lowercase letter +`t`, followed by optional `.` character. + +
+"[f|c|m]at\.?" => The fat cat sat on the mat.
 
\ No newline at end of file