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
End of string + 0-Width assertion oddity #2406
Comments
From @btillyCreated by ben_tilly@hotmail.comI actually know the design decisions that led to this. I still think perl -e '$str = "Hello World\n"; Try it. $str winds up with two returns. Once from matching the Another idea that Tye McQueen tossed at me is that instead of just Perl Info
|
From @ysthIn article <LAW2-F130FRaqbC8wSA000014bd@hotmail.com>,
I don't understand the problem. It's matching once at pos 11 (with The following, on the other hand, does seem a little odd: perl -Dr -e '$str="Hello World\n"; print |
From @btillyYitzchak Scott-Thoennes wrote:
Define problem? It is documented in perlre, in a section which is Now why doesn't it find the second match a few dozen more times?
It works as designed. Match zero times. Try again, can't because *shrug* Ben |
From @ysthIn article <LAW2-F54lLRa8174jDJ0000488b@hotmail.com>,
I guess I should have said I don't understand your proposed solution.
How would you simplify it? From your phrase "after matching $ you
Yes, of course. Now I don't see what was confusing me. :) |
From @btillyYitzchak Scott-Thoennes wrote:
Well my initial thought is that someone who asked to match $ is However I believe that a simpler rule is, "two matches cannot end
I ran it on a Perl without debugging. Made it easier. :-) Cheers, PS Sorry for the resend, forgot to cc p5p the first time. :-( |
From @ysthIn article <LAW2-F146PaatKGS7hD00003113@hotmail.com>,
Let me make sure I'm understanding you. So you would want this: [D:\home\sthoenna]perl -wle "print map qq:<$_>:, 'abc'=~/.??/g" to instead output <><a><b><c> ?? I'm not sure that's less unexpected. |
From @btillyYitzchak Scott-Thoennes wrote:
That would be correct, but I am dubious that /.??/g has any Cheers, |
From [Unknown Contact. See original ticket]Ben Tilly wrote:
What about while ($text =~ /$token/g) { ? If $optional_token matches "" then this would fail? That doesn't seem Note that you can't fix this by just resetting the print length($1) while /\G($optional_token)/g; would loop forever. |
From @btillyRick Delaney wrote:
[...]
What about testing several optional tokens in a row at the same Is it better to break assumptions early, or late?
Yup. Perhaps I should just patch the current explanation to move |
From @ysthIn article <LAW2-F49HXG2U9iTb8k00004ca5@hotmail.com>,
Agreed. It is good for showing people how the exception works, though. |
From [Unknown Contact. See original ticket]Ben Tilly wrote:
Good point.
You could always suggest a pragma. I can see value in each of the three |
From @btillyRick Delaney wrote:
[...]
Anyone with enough tuits to use the pragma IMO should be assumed to OTOH the pragma that I *really* want to see is one to force the No idea how hard it would be though. Cheers, |
From @vanstynIn <LAW2-F64rkgeSvKHJz6000063e1@hotmail.com>, "Ben Tilly" writes: I'm not sure I understand what you mean by 'how many matches it The trouble is that it is quite reasonable for the main engine to Hugo |
From @btillyHugo wrote:
Yeah, except when it is done go back and try again.
That is *exactly* what I am talking about. If you run it with
Unless it was mentioned as a wise test to proactively put into The idea is to have an easy way to make Perl search for Cheers, PS Hugo, sorry for the resend. Forgot to cc p5p. |
@chorny - Status changed from 'open' to 'stalled' |
Migrated from rt.perl.org#3762 (status was 'stalled')
Searchable as RT3762$
The text was updated successfully, but these errors were encountered: