Skip to content

Commit 17571a9

Browse files
committed
Fix ziishaned#86 - Replace character set with character group
1 parent c38baf1 commit 17571a9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,13 @@ that is matched by the first part of the expression. To define a positive
405405
lookahead, parentheses are used. Within those parentheses, a question mark with
406406
equal sign is used like this: `(?=...)`. Lookahead expression is written after
407407
the equal sign inside parentheses. For example, the regular expression
408-
`[T|t]he(?=\sfat)` means: optionally match lowercase letter `t` or uppercase
408+
`(T|t)he(?=\sfat)` means: optionally match lowercase letter `t` or uppercase
409409
letter `T`, followed by letter `h`, followed by letter `e`. In parentheses we
410410
define positive lookahead which tells regular expression engine to match `The`
411411
or `the` which are followed by the word `fat`.
412412

413413
<pre>
414-
"[T|t]he(?=\sfat)" => <a href="#learn-regex"><strong>The</strong></a> fat cat sat on the mat.
414+
"(T|t)he(?=\sfat)" => <a href="#learn-regex"><strong>The</strong></a> fat cat sat on the mat.
415415
</pre>
416416

417417
[Test the regular expression](https://regex101.com/r/IDDARt/1)
@@ -422,12 +422,12 @@ Negative lookahead is used when we need to get all matches from input string
422422
that are not followed by a pattern. Negative lookahead defined same as we define
423423
positive lookahead but the only difference is instead of equal `=` character we
424424
use negation `!` character i.e. `(?!...)`. Let's take a look at the following
425-
regular expression `[T|t]he(?!\sfat)` which means: get all `The` or `the` words
425+
regular expression `(T|t)he(?!\sfat)` which means: get all `The` or `the` words
426426
from input string that are not followed by the word `fat` precedes by a space
427427
character.
428428

429429
<pre>
430-
"[T|t]he(?!\sfat)" => The fat cat sat on <a href="#learn-regex"><strong>the</strong></a> mat.
430+
"(T|t)he(?!\sfat)" => The fat cat sat on <a href="#learn-regex"><strong>the</strong></a> mat.
431431
</pre>
432432

433433
[Test the regular expression](https://regex101.com/r/V32Npg/1)
@@ -436,11 +436,11 @@ character.
436436

437437
Positive lookbehind is used to get all the matches that are preceded by a
438438
specific pattern. Positive lookbehind is denoted by `(?<=...)`. For example, the
439-
regular expression `(?<=[T|t]he\s)(fat|mat)` means: get all `fat` or `mat` words
439+
regular expression `(?<=(T|t)he\s)(fat|mat)` means: get all `fat` or `mat` words
440440
from input string that are after the word `The` or `the`.
441441

442442
<pre>
443-
"(?<=[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>.
443+
"(?<=(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>.
444444
</pre>
445445

446446
[Test the regular expression](https://regex101.com/r/avH165/1)
@@ -453,7 +453,7 @@ regular expression `(?<!(T|t)he\s)(cat)` means: get all `cat` words from input
453453
string that are not after the word `The` or `the`.
454454

455455
<pre>
456-
"(?&lt;![T|t]he\s)(cat)" => The cat sat on <a href="#learn-regex"><strong>cat</strong></a>.
456+
"(?&lt;!(T|t)he\s)(cat)" => The cat sat on <a href="#learn-regex"><strong>cat</strong></a>.
457457
</pre>
458458

459459
[Test the regular expression](https://regex101.com/r/8Efx5G/1)

0 commit comments

Comments
 (0)