mirror of
https://github.com/ziishaned/learn-regex.git
synced 2025-09-10 07:36:04 -04:00
Merge 16108a37a462613121f27e719d379fabc79031a9 into 9498781445347c1550af7f4cf9f61f091e6e7b7b
This commit is contained in:
commit
4a932ad03f
@ -349,7 +349,6 @@ character.
|
|||||||
<pre>
|
<pre>
|
||||||
"(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>
|
"(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>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
[Test the regular expression](https://regex101.com/r/DOc5Nu/1)
|
[Test the regular expression](https://regex101.com/r/DOc5Nu/1)
|
||||||
|
|
||||||
## 2.8 Anchors
|
## 2.8 Anchors
|
||||||
@ -421,7 +420,7 @@ regular expressions:
|
|||||||
|
|
||||||
Lookbehinds and lookaheads (also called lookarounds) are specific types of
|
Lookbehinds and lookaheads (also called lookarounds) are specific types of
|
||||||
***non-capturing groups*** (used to match a pattern but without including it in the matching
|
***non-capturing groups*** (used to match a pattern but without including it in the matching
|
||||||
list). Lookarounds are used when we a pattern must be
|
list). Lookarounds are used when want to check if a pattern is
|
||||||
preceded or followed by another pattern. For example, imagine we want to get all
|
preceded or followed by another pattern. For example, imagine we want to get all
|
||||||
numbers that are preceded by the `$` character from the string
|
numbers that are preceded by the `$` character from the string
|
||||||
`$4.44 and $10.88`. We will use the following regular expression `(?<=\$)[0-9\.]*`
|
`$4.44 and $10.88`. We will use the following regular expression `(?<=\$)[0-9\.]*`
|
||||||
@ -429,6 +428,10 @@ which means: get all the numbers which contain the `.` character and are precede
|
|||||||
by the `$` character. These are the lookarounds that are used in regular
|
by the `$` character. These are the lookarounds that are used in regular
|
||||||
expressions:
|
expressions:
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
"(?<=\$)[0-9.]*" => The prices of monitors vary from $<a href="#learn-regex"><strong>10.88</strong></a> to $<a href="#learn-regex"><strong>4.44</strong></a>
|
||||||
|
</pre>
|
||||||
|
|
||||||
|Symbol|Description|
|
|Symbol|Description|
|
||||||
|:----:|----|
|
|:----:|----|
|
||||||
|?=|Positive Lookahead|
|
|?=|Positive Lookahead|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user