Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Issue with matching regex

by Athanasius (Archbishop)
on Oct 20, 2022 at 14:12 UTC ( #11147542=note: print w/replies, xml ) Need Help??


in reply to Re^2: Issue with matching regex
in thread Issue with matching regex

Thanks choroba,

I didn’t know that! This special case must have been implemented for a reason, but I can’t think what it could have been.

Using a non-capturing group to avoid this behaviour is a useful workaround.

The good news is that this special case doesn’t seem to be present in Raku:

23:48 >perl -wE "my $s = ''; say 'match1' if 'abc' =~ /b/; say 'match2 +' if 'adc =~ /(?:$s)/;" match1 match2 23:55 >perl -wE "my $s = ''; say 'match1' if 'abc' =~ /b/; say 'match2 +' if 'adc =~ /$s/;" match1 23:56 >raku -e "my Str $s = ''; say 'match1' if 'abc' ~~ /b/; say 'mat +ch2' if 'adc' ~~ /$s/;" match1 match2 23:56 >

Cheers,

Athanasius <°(((><contra mundum סתם עוד האקר של פרל,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11147542]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2022-12-03 06:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?