Skip to content

Commit 728d606

Browse files
committed
Update
1 parent c67970c commit 728d606

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

README.md

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
<br/>
2+
<p align="center">
3+
<img src="https://i.imgur.com/srSc0oK.png" alt="Logo">
4+
</p><br/>
5+
16
## What is Regular Expression?
27

38
> Regular expression is a group of characters or symbols which is used to find a specific pattern from a text.
@@ -19,32 +24,33 @@ contains uppercase letter and also it is too short.
1924

2025
## Table of Contents
2126

22-
- [Basic Matchers]()
23-
- [Meta character]()
24-
- [Full stop]()
25-
- [Character set]()
26-
- [Negated character set]()
27-
- [Repetitions]()
28-
- [The Star]()
29-
- [The Plus]()
30-
- [The Question Mark]()
31-
- [Character Group]()
32-
- [Alternation]()
33-
- [Escaping special character]()
34-
- [Anchors]()
35-
- [Caret]()
36-
- [Dollar]()
37-
- [Shorthand Character Sets]()
38-
- [Lookaround]()
39-
- [Positive Lookahead]()
40-
- [Negative Lookahead]()
41-
- [Positive Lookbehind]()
42-
- [Negative Lookbehind]()
43-
- [Flags]()
44-
- [Case Insensitive]()
45-
- [Global search]()
46-
- [Multiline]()
47-
- [Bonus]()
27+
- [Basic Matchers](#1-basic-matchers)
28+
- [Meta character](#2-meta-characters)
29+
- [Full stop](#21-full-stop)
30+
- [Character set](#22-character-set)
31+
- [Negated character set](#221-negated-character-set)
32+
- [Repetitions](#23-repetitions)
33+
- [The Star](#231-the-star)
34+
- [The Plus](#232-the-plus)
35+
- [The Question Mark](#233-the-question-mark)
36+
- [Braces](#24-braces)
37+
- [Character Group](#25-character-group)
38+
- [Alternation](#26-alternation)
39+
- [Escaping special character](#27-escaping-special-character)
40+
- [Anchors](#28-anchors)
41+
- [Caret](#281-caret)
42+
- [Dollar](#282-dollar)
43+
- [Shorthand Character Sets](#3-shorthand-character-sets)
44+
- [Lookaround](#4-ookaround)
45+
- [Positive Lookahead](#41-positive-lookahead)
46+
- [Negative Lookahead](#42-negative-lookahead)
47+
- [Positive Lookbehind](#43-positive-lookbehind)
48+
- [Negative Lookbehind](#44-negative-lookbehind)
49+
- [Flags](#5-flags)
50+
- [Case Insensitive](#51-case-insensitive)
51+
- [Global search](#52-global-search)
52+
- [Multiline](#53-multiline)
53+
- [Bonus](#bonus)
4854

4955
## 1. Basic Matchers
5056

@@ -188,7 +194,7 @@ the comma the regular expression `[0-9]{2}` means: Match exactly 2 digits.
188194
"[0-9]{2}" => The number was 9.<a href="#learn-regex"><strong>99</strong></a><a href="#learn-regex"><strong>97</strong></a> but we rounded it off to <a href="#learn-regex"><strong>10</strong></a>.0.
189195
</pre>
190196

191-
## 2.4 Character Group
197+
## 2.5 Character Group
192198

193199
Character group is a group of sub-pattern that is written inside Parentheses `(...)`. As we discussed before that in regular expression
194200
if we put quantifier after character than it will repeats the preceding character. But if we put quantifier after a character group than
@@ -200,7 +206,7 @@ We can also use the alternation `|` meta character inside character group. For e
200206
"(c|g|p)ar" => The <a href="#learn-regex"><strong>car</strong></a> is <a href="#learn-regex"><strong>par</strong></a>ked in the <a href="#learn-regex"><strong>gar</strong></a>age.
201207
</pre>
202208

203-
## 2.5 Alternation
209+
## 2.6 Alternation
204210

205211
In regular expression Vertical bar `|` is used to define alternation. Alternation is like a condition between multiple expressions. Now,
206212
you maybe thinking that character set and alternation works the same way. But the big difference between character set and alternation
@@ -212,7 +218,7 @@ or lowercase character `c`, followed by lowercase character `a`, followed by low
212218
"[T|t]he|car" => <a href="#learn-regex"><strong>The</strong></a> <a href="#learn-regex"><strong>car</strong></a> is parked in <a href="#learn-regex"><strong>the</strong></a> garage.
213219
</pre>
214220

215-
## 2.6 Escaping special character
221+
## 2.7 Escaping special character
216222

217223
Backslash `\` is used in regular expression to escape the next character. This allows to to specify a symbol as a matching character
218224
including reserved characters `{ } [ ] / \ + * . $ ^ | ?`. To use a special character as a matching character prepend `\` before it.
@@ -224,13 +230,13 @@ expression `[f|c|m]at\.?` means: lowercase letter `f`, `c` or `m`, followed by l
224230
"[f|c|m]at\.?" => The <a href="#learn-regex"><strong>fat</strong></a> <a href="#learn-regex"><strong>cat</strong></a> sat on the <a href="#learn-regex"><strong>mat.</strong></a>
225231
</pre>
226232

227-
## 2.7 Anchors
233+
## 2.8 Anchors
228234

229235
In regular expression to check if the matching symbol is the starting symbol or endnig symbol of the input string for this purpose
230236
we use anchors. Anchors are of two types: First type is Caret `^` that check if the matching character is the start character of the
231237
input and the second type is Dollar `$` that checks if matching character is the last character of the input string.
232238

233-
### 2.7.1 Caret
239+
### 2.8.1 Caret
234240

235241
Caret `^` symbol is used to check if matching character is the first character of the input string. If we apply the following regular
236242
expression `^a` (if a is the starting symbol) to input string `abc` it matches `a`. But if we apply regular expression `^b` on above
@@ -246,7 +252,7 @@ followed by lowercase character `h`, followed by lowercase character `e`.
246252
"^[T|t]he" => <a href="#learn-regex"><strong>The</strong></a> car is parked in the garage.
247253
</pre>
248254

249-
### 2.7.2 Dollar
255+
### 2.8.2 Dollar
250256

251257
Dollar `$` symbol is used to check if matching character is the last character of the input string. For example regular expression
252258
`(at.)$` means: lowercase character `a`, followed by lowercase character `t`, followed by anything except new line and the matcher

0 commit comments

Comments
 (0)