Skip to content

Commit 46af8e3

Browse files
falaktheoptimistziishaned
authored andcommitted
Fix ziishaned#27 and grammatical fixes
* Addressing Hashtags and @mentions Added both cases in the bonus section * Minor grammatical fixes Fixes to issue ziishaned#27
1 parent 021920c commit 46af8e3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ the comma the regular expression `[0-9]{3}` means: Match exactly 3 digits.
225225
## 2.5 Character Group
226226

227227
Character group is a group of sub-patterns that is written inside Parentheses `(...)`. As we discussed before that in regular expression
228-
if we put a quantifier after a character than it will repeat the preceding character. But if we put quantifier after a character group then
228+
if we put a quantifier after a character then it will repeat the preceding character. But if we put quantifier after a character group then
229229
it repeats the whole character group. For example, the regular expression `(ab)*` matches zero or more repetitions of the character "ab".
230230
We can also use the alternation `|` meta character inside character group. For example, the regular expression `(c|g|p)ar` means: lowercase character `c`,
231231
`g` or `p`, followed by character `a`, followed by character `r`.
@@ -328,7 +328,7 @@ regular expressions. The shorthand character sets are as follows:
328328
Lookbehind and lookahead sometimes known as lookaround are specific type of ***non-capturing group*** (Use to match the pattern but not
329329
included in matching list). Lookaheads are used when we have the condition that this pattern is preceded or followed by another certain
330330
pattern. For example, we want to get all numbers that are preceded by `$` character from the following input string `$4.44 and $10.88`.
331-
We will use following regular expression `(?<=\$)[0-9\.]*` which means: get all the numbers which contains `.` character and preceded
331+
We will use following regular expression `(?<=\$)[0-9\.]*` which means: get all the numbers which contain `.` character and are preceded
332332
by `$` character. Following are the lookarounds that are used in regular expressions:
333333

334334
|Symbol|Description|
@@ -482,7 +482,8 @@ line. And because of `m` flag now regular expression engine matches pattern at t
482482
* *Date (MM/DD/YYYY)*: `^(0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2}$`
483483
* *Date (YYYY/MM/DD)*: `^(19|20)?[0-9]{2}[- /.](0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])$`
484484
* *MasterCard credit card numbers*: `^(5[1-5][0-9]{14})*$`
485-
485+
* *Hashtags*: Including hashtags with preceding text (abc123#xyz456) or containing white spaces within square brackets (#[foo bar]) : `\S*#(?:\[[^\]]+\]|\S+)`
486+
* *@mentions*: `\B@[a-z0-9_-]+`
486487
## Contribution
487488

488489
* Report issues

0 commit comments

Comments
 (0)