[perl #130586] [REGEX] "Iteration Past End" with Empty Character Class that has unescaped space in it <[email protected]>
[email protected] ("Aleks-Daniel Jakimenko-Aleksejev via RT") Sat, 17 Mar 2018 13:43:05 -0700
| Newsgroups | perl.perl6.compiler |
|---|---|
| Message-ID | <[email protected]> |
Further discussion on https://github.com/rakudo/rakudo/issues/1622. On 2017-01-21 14:13:42, [email protected] wrote: > On Wed, 18 Jan 2017 18:16:20 -0800, [email protected] wrote: > > the :sigspace adverb does not affect spaces inside character class. > > Should it? > > > No, I don't think so. `<.ws>` can match any number of characters > (including zero). A char class is defining something a matcher for a > single character. > > > Note that having JUST space inside also causes a weird error to be > > thrown: > > > > <Zoffix> m: say " " ~~ m:s/<-[ ]>/ > > <camelia> rakudo-moar 1aeea1: OUTPUT«===SORRY!===Iteration past end > > of iterator» > > > That one's certainly a bug. Since whitespace in a charclass is not > significant, then it should complain about an empty charclass, > preferably with a hint about space. > > > <Zoffix> m: say " " ~~ m:s/<-[x ]>/ > > <camelia> rakudo-moar 1aeea1: OUTPUT«「 」» > This matches because it's the same as m:s/<-[x]>/. You'd need to write > <-[x\ ]> to make the space significant. > > > <Zoffix> m: say " " ~~ m:s/<-[ x]>/ > > <camelia> rakudo-moar 1aeea1: OUTPUT«「 」» > Ditto. > > /jnthn