On Fri, 29 Dec 2017 07:05:29 -0800, sml...@gmail.com wrote:
> These regexes parse and run fine (they match a single `#` character):
> 
>     /\#/;
>     /^\#/;
> 
> But this one doesn't:
> 
>     /^ \#/;
> 
> The error thrown, is:
> 
>     ===SORRY!===
>     Regex not terminated.
>     at -e:1
>     ------> /^ \#/⏏<EOL>
>     Unable to parse regex; couldn't find final '/'
>     at -e:1
>     ------> /^ \#/⏏<EOL>
>         expecting any of:
>             infix stopper
> 
> It's as if the parser fails to recognize that the `#` character was
> escaped (interpreting the backslash as unspace maybe?), and treats
> everything until the end of the line as a comment.
> 
> This seems to be only happening when the escaped `#` character is
> preceded by another token, *and* separated from it by whitespace.
> 
> Apparently this bug has always existed in Rakudo:
> https://gist.github.com/Whateverable/ca082a33d2ab689bf3ca4b6f7ae2d19f


Thank you for the report. This is a duplicate of 
https://github.com/rakudo/rakudo/issues/1324

The problematic cases are matched[^1] as unspaces. The `\#` thing was never 
meant[^2] to work, but it slipped through and now we probably have to deal with 
back-compat issues in order to fix it.

[1] https://github.com/rakudo/rakudo/issues/1324#issuecomment-353233051
[2] https://github.com/rakudo/rakudo/issues/1324#issuecomment-353435175

Reply via email to