There's a good discussion at the following URL but it occurs because the 
regular expression is evaluated as a state machine. Here the capturing group 
itself is repeated by the {2}. The first match is discarded when it sees the 
second match and that's what you see in the results.

https://www.regular-expressions.info/captureall.html 
<https://www.regular-expressions.info/captureall.html>

[fletcher]


> On Mar 6, 2020, at 7:25 PM, Howard <[email protected]> wrote:
> 
> When using the Pattern Playground, in the search pattern's capture group #1 
> (see below), why is `847-` appearing rather than `717-`?
> 
> Search pattern: (\d{3}[.-]?){2}
> 
> Source text: 717-847-8015
> 
> Capture Groups:
> #0: 717-847-
> #1: 847-
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "[email protected]" 
> rather than posting here. Follow @bbedit on Twitter: 
> <https://twitter.com/bbedit <https://twitter.com/bbedit>>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/32702e50-f03b-4a76-94a1-6974886c4f0b%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/bbedit/32702e50-f03b-4a76-94a1-6974886c4f0b%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/DC6CF50B-B3E8-452D-BC30-2B0033B0C79B%40cumuli.com.

Reply via email to