Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified quantifier should be better explained. #1163

Closed
bbkr opened this issue Jan 24, 2017 · 3 comments
Closed

Modified quantifier should be better explained. #1163

bbkr opened this issue Jan 24, 2017 · 3 comments
Assignees
Labels
docs Documentation issue (primary issue type)

Comments

@bbkr
Copy link
Contributor

bbkr commented Jan 24, 2017

https://docs.perl6.org/language/regexes#Modified_quantifier:_%

It's not clear that quantifier in a+ % ',' example is applied to delimited items count instead of character class. I had to check Roast test to see that this:

$ perl6 -e 'say "aa,aaaa,aaa" ~~ /a+ % ","/'
「a」  # ooops!

Should be double wrapped like:

$ perl6 -e 'say "aa,aaaa,aaa" ~~ /[a+]+ % ","/'
「aa,aaaa,aaa」

I think adding additional more complex example should make it more clear:

$ perl6 -e 'say "foo,bar,baz" ~~ / [\w+] ** 2 % "," /'
「foo,bar」

And here is the design discussion for reference: https://irclog.perlgeek.de/perl6/2011-09-20#i_4453865

@coke coke added the docs Documentation issue (primary issue type) label Jan 24, 2017
@moritz moritz closed this as completed in a206c60 Sep 2, 2017
@AlexDaniel
Copy link
Member

FWIW I agree that this is not a trap, but a simple misunderstanding that should be covered in language/regexes. A trap would be something that makes you think that your code works, but in reality there are edge cases that may lead to disastrous results. We should delete some sections from language/traps that do not match this definition.

@rafaelschipiura rafaelschipiura changed the title Modified quantifier trap should be better explained. Modified quantifier should be better explained. Sep 3, 2017
@rafaelschipiura
Copy link
Contributor

So, reopening because the docs on quantifiers are still LTA.

@AlexDaniel
Copy link
Member

@rafaelschipiura I was thinking that a206c60 is enough, I guess not. What exactly is less than awesome?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation issue (primary issue type)
Projects
None yet
Development

No branches or pull requests

4 participants