in reply to Re^4: about style: use possessive or atomic?
in thread about style: use possessive or atomic?
Is it true that ($match){1}+ equals to simply $match? Yes, and the + does nothing here, as you can see with use warnings:
That's only true because you the OP included a quantifier in the embedded regex; and you get 3 fails because your anchors guarantee the regex used couldn't succeed (which doesn't seem like a useful test?)
This shows that {n}+ is a valid quantifier:
use strict; use warnings; chomp(my $match = <DATA>); chomp( $_ = <DATA>); for my $regex ( "($match){1}+", "($match){1}", "($match)", "($match)+", "($match)+?", ) { print qw(FAIL SUCCESS)[ !! m/$regex/ ], "\n" } __DATA__ (?:a|b) bbab
C:\test>junk37 SUCCESS SUCCESS SUCCESS SUCCESS SUCCESS
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: about style: use possessive or atomic?
by Athanasius (Archbishop) on Aug 16, 2015 at 13:25 UTC | |
by BrowserUk (Patriarch) on Aug 16, 2015 at 13:41 UTC | |
by Athanasius (Archbishop) on Aug 16, 2015 at 14:13 UTC | |
by stevieb (Canon) on Aug 16, 2015 at 15:20 UTC | |
by LanX (Saint) on Aug 16, 2015 at 20:18 UTC | |
by LanX (Saint) on Aug 16, 2015 at 22:58 UTC | |
by rsFalse (Chaplain) on Aug 16, 2015 at 23:28 UTC | |
by LanX (Saint) on Aug 16, 2015 at 23:51 UTC | |
|