Re: Is this a strange regex bug in my code?

2014-12-30 Thread Gabor Szabo
if not $tmpl ~~ m/\.txt$/ { ... } fails the same way. if not $tmpl ~~ /\.txt$/ { ... } works like a charm. Gabor On Tue, Dec 30, 2014 at 9:48 AM, Patrick R. Michaud pmich...@pobox.com wrote: I suspect it may be some weirdness with the way that $_ is being handled in smartmatching,

Is this a strange regex bug in my code?

2014-12-29 Thread Gabor Szabo
I am puzzled by this. I have code like this: my @files = dir($.source_dir).map({ $_.basename }); for @files - $tmpl { if $tmpl !~~ m/\.txt$/ { debug(Skipping '$tmpl' it does not end with .txt); next; } debug(Source file $tmpl); } and

Re: Is this a strange regex bug in my code?

2014-12-29 Thread Gabor Szabo
No. If I remove the leading m from the regex, then the bug is gone. Gabor On Tue, Dec 30, 2014 at 9:19 AM, Patrick R. Michaud pmich...@pobox.com wrote: Out of curiosity, is the bug still present if you use /\.txt$/ instead of m/\.txt$/ ? At the moment it looks like a Rakudo bug to me, but I

Re: Is this a strange regex bug in my code?

2014-12-29 Thread Patrick R. Michaud
I suspect it may be some weirdness with the way that $_ is being handled in smartmatching, then. I think there's a slight difference between $tmpl ~~ /regex/ and $tmpl ~~ m/regex/ The first one does the equivalent of /regex/.ACCEPTS($tmpl), which ends up matching $tmpl directly