@@ -55,23 +55,23 @@ contains uppercase letter and also it is too short.
5555## 1. Basic Matchers
5656
5757A regular expression is just a pattern of letters and digits that we use to perform search in a text. For example, the regular expression
58- ` cat ` means: the letter ` c ` , followed by the letter ` a ` , followed by the letter ` t ` .
58+ ` the ` means: the letter ` t ` , followed by the letter ` h ` , followed by the letter ` e ` .
5959
6060<pre >
61- "cat " => The <a href =" #learn-regex " ><strong >cat </strong ></a > sat on the mat
61+ "the " => The fat cat sat on <a href =" #learn-regex " ><strong >the </strong ></a > mat.
6262</pre >
6363
64- [ Test the regular expression] ( https://regex101.com/r/FOq5Nb /1 )
64+ [ Test the regular expression] ( https://regex101.com/r/dmRygT /1 )
6565
66- The regular expression ` 123 ` matches the string " 123" . The regular expression is matched against an input string by comparing each
66+ The regular expression ` 123 ` matches the string ` 123 ` . The regular expression is matched against an input string by comparing each
6767character in the regular expression to each character in the input string, one after another. Regular expressions are normally
68- case-sensitive so the regular expression ` Cat ` would not match the string "cat" .
68+ case-sensitive so the regular expression ` The ` would not match the string ` the ` .
6969
7070<pre >
71- "Cat " => The cat sat on the <a href =" #learn-regex " ><strong >Cat </strong ></a >
71+ "The " => <a href =" #learn-regex " ><strong >The </strong ></a > fat cat sat on the mat.
7272</pre >
7373
74- [ Test the regular expression] ( https://regex101.com/r/jw4Vi6 /1 )
74+ [ Test the regular expression] ( https://regex101.com/r/1paXsy /1 )
7575
7676## 2. Meta Characters
7777
@@ -220,7 +220,7 @@ the comma the regular expression `[0-9]{3}` means: Match exactly 3 digits.
220220"[0-9]{3}" => The number was 9.<a href =" #learn-regex " ><strong >999</strong ></a >7 but we rounded it off to 10.0.
221221</pre >
222222
223- [ Test the regular expression] ( https://regex101.com/r/gqajq8 /1 )
223+ [ Test the regular expression] ( https://regex101.com/r/Sivu30 /1 )
224224
225225## 2.5 Character Group
226226
@@ -343,40 +343,40 @@ by `$` character. Following are the lookarounds that are used in regular express
343343The positive lookahead asserts that the first part of the expression must be followed by the lookahead expression. The returned match
344344only contains the text that is matched by the first part of the expression. To define a positive lookahead, parentheses are used. Within
345345those parentheses, a question mark with equal sign is used like this: ` (?=...) ` . Lookahead expression is written after the equal sign inside
346- parentheses. For example, the regular expression ` ( T|t) he(?=\sfat)` means: optionally match lowercase letter ` t ` or uppercase letter ` T ` ,
346+ parentheses. For example, the regular expression ` [ T|t] he(?=\sfat)` means: optionally match lowercase letter ` t ` or uppercase letter ` T ` ,
347347followed by letter ` h ` , followed by letter ` e ` . In parentheses we define positive lookahead which tells regular expression engine to match
348348` The ` or ` the ` which are followed by the word ` fat ` .
349349
350350<pre >
351- "( T|t) he(?=\sfat)" => <a href =" #learn-regex " ><strong >The</strong ></a > fat cat sat on the mat.
351+ "[ T|t] he(?=\sfat)" => <a href =" #learn-regex " ><strong >The</strong ></a > fat cat sat on the mat.
352352</pre >
353353
354- [ Test the regular expression] ( https://regex101.com/r/apqJZq /1 )
354+ [ Test the regular expression] ( https://regex101.com/r/IDDARt /1 )
355355
356356### 4.2 Negative Lookahead
357357
358358Negative lookahead is used when we need to get all matches from input string that are not followed by a pattern. Negative lookahead
359359defined same as we define positive lookahead but the only difference is instead of equal ` = ` character we use negation ` ! ` character
360- i.e. ` (?!...) ` . Let's take a look at the following regular expression ` ( T|t) he(?!\sfat)` which means: get all ` The ` or ` the ` words from
360+ i.e. ` (?!...) ` . Let's take a look at the following regular expression ` [ T|t] he(?!\sfat)` which means: get all ` The ` or ` the ` words from
361361input string that are not followed by the word ` fat ` precedes by a space character.
362362
363363<pre >
364- "( T|t) he(?!\sfat)" => The fat cat sat on <a href =" #learn-regex " ><strong >the</strong ></a > mat.
364+ "[ T|t] he(?!\sfat)" => The fat cat sat on <a href =" #learn-regex " ><strong >the</strong ></a > mat.
365365</pre >
366366
367- [ Test the regular expression] ( https://regex101.com/r/sswCvQ /1 )
367+ [ Test the regular expression] ( https://regex101.com/r/V32Npg /1 )
368368
369369### 4.3 Positive Lookbehind
370370
371371Positive lookbehind is used to get all the matches that are preceded by a specific pattern. Positive lookbehind is denoted by
372- ` (?<=...) ` . For example, the regular expression ` (?<=( T|t) he\s)(fat|mat) ` means: get all ` fat ` or ` mat ` words from input string that
372+ ` (?<=...) ` . For example, the regular expression ` (?<=[ T|t] he\s)(fat|mat) ` means: get all ` fat ` or ` mat ` words from input string that
373373are after the word ` The ` or ` the ` .
374374
375375<pre >
376- "(?<=( T|t) he\s)(fat|mat)" => The <a href =" #learn-regex " ><strong >fat</strong ></a > cat sat on the <a href =" #learn-regex " ><strong >mat</strong ></a >.
376+ "(?<=[ T|t] he\s)(fat|mat)" => The <a href =" #learn-regex " ><strong >fat</strong ></a > cat sat on the <a href =" #learn-regex " ><strong >mat</strong ></a >.
377377</pre >
378378
379- [ Test the regular expression] ( https://regex101.com/r/TZ8DOX/1/ )
379+ [ Test the regular expression] ( https://regex101.com/r/avH165/1 )
380380
381381### 4.4 Negative Lookbehind
382382
@@ -385,10 +385,10 @@ Negative lookbehind is used to get all the matches that are not preceded by a sp
385385are not after the word ` The ` or ` the ` .
386386
387387<pre >
388- "(?< ; !( T|t) he\s)(cat)" => The cat sat on <a href =" #learn-regex " ><strong >cat</strong ></a >.
388+ "(?< ; ![ T|t] he\s)(cat)" => The cat sat on <a href =" #learn-regex " ><strong >cat</strong ></a >.
389389</pre >
390390
391- [ Test the regular expression] ( https://regex101.com/r/gleYg9 /1 )
391+ [ Test the regular expression] ( https://regex101.com/r/8Efx5G /1 )
392392
393393## 5. Flags
394394
0 commit comments