diff --git a/README.md b/README.md index e065574..79c983e 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ A regular expression is just a pattern of letters and digits that we used to sea `cat` means: the letter `c`, followed by the letter `a`, followed by the letter `t`.
-"cat" => The cat sat on the mat
+"cat" => The cat sat on the mat
 
The regular expression `123` matches the string "123". The regular expression is matched against an input string by comparing each @@ -43,7 +43,7 @@ character in the regular expression to each character in the input string, one a case-sensitive so the regular expression `Cat` would not match the string "cat".
-"Cat" => The cat sat on the Cat
+"Cat" => The cat sat on the Cat
 
## 2. Meta Characters @@ -60,7 +60,7 @@ The meta character are as follows: |*|Matches 0 or more repetitions of the preceding symbol.| |+|Matches 1 or more repetitions of the preceding symbol. |?|Makes the preceding symbol optional.| -|{n}|Braces. Matches ā€œnā€ repetitions of the preceding symbol.| +|{n,m}|Braces. Matches at least "n" but not more than "m" repetitions of the preceding symbol.| |(xyz)|Character group. Matches the characters xyz in that exact order.| |||Alternation. Matches either the characters before or the characters after the symbol.| |\|Escapes the next character. This allows you to match reserved characters [ ] ( ) { } . * + ? ^ $ \ || @@ -74,7 +74,7 @@ or new line characters. For example the regular expression `.ar` means: any char letter `r`.
-".ar" => The car parked in the garage.
+".ar" => The car parked in the garage.
 
## 2.2 Character set @@ -84,13 +84,13 @@ specify the characters range. The order of the character range inside square bra expression `[Tt]he` means: an uppercase `T` or lowercase `t`, followed by the letter `h`, followed by the letter `e`.
-"[Tt]he" => The car parked in the garage.
+"[Tt]he" => The car parked in the garage.
 
Just like above example the regular expression `ar[.]` means: an lowercase character `a`, followed by letter `r`, followed by any character.
-"ar[.]" => The car parked in the garage.
+"ar[.]" => The car parked in the garage.
 
### 2.2.1 Negated character set @@ -100,7 +100,7 @@ character set. For example the regular expression `[^c]ar` means: any character the letter `r`.
-"[^c]ar" => The car parked in the garage.
+"[^c]ar" => The car parked in the garage.
 
@@ -116,7 +116,7 @@ of preceding lowercase character `a`. But if it apperas after a character set or character set. For example the regular expression `[a-z]*` means: any number of lowercase letters in a row.
-"[a-z]*" => The car parked in the garage #21.
+"[a-z]*" => The car parked in the garage #21.
 
The `*` symbol can be used with the meta character `.` to match any string of characters `.*`. The `*` symbol can be used with the @@ -125,7 +125,7 @@ spaces, followed by lowercase character `c`, followed by lowercase character `a` zero or more spaces.
-"\s*cat\s*" => The fat cat sat on the cat.
+"\s*cat\s*" => The fat cat sat on the cat.
 
### 2.3.2 The Plus @@ -134,7 +134,7 @@ The symbol `+` matches one or more repetitions of the preceding character. For e letter `c`, followed by any number of character, followed by the lowercase character `t`.
-"c.+t" => The fat cat sat on the mat.
+"c.+t" => The fat cat sat on the mat.
 
### 2.3.3 The Question Mark @@ -144,9 +144,29 @@ the preceding character. For example the regular expression `[T]?he` means: Opti character `h`, followed by the lowercase character `e`.
-"[T]he" => The car is parked in the garage.
+"[T]he" => The car is parked in the garage.
 
-"[T]?he" => The car is parked in the garage.
+"[T]?he" => The car is parked in the garage.
 
+## 2.4 Braces + +In regular expression braces that are also called quantifiers used to specify the number of times that a group of character or a +character can be repeated. For example the regular expression `[0-9]{2,3}` means: Match at least 2 digits but not more than 3 ( +characters in the range of 0 to 9). + +
+"[0-9]{2}" => The number was 9.9997 but we rounded it off to 10.0.
+
+ +We can leave out the second number. For example the regular expression `[0-9]{2,}` means: Match 2 or more digits. If we also remove +the comma the regular expression `[0-9]{2}` means: Match exactly 2 digits. + +
+"[0-9]{2,}" => The number was 9.9997 but we rounded it off to 10.0.
+
+ +
+"[0-9]{2}" => The number was 9.9997 but we rounded it off to 10.0.
+
\ No newline at end of file