This got me farther in some perl5 regexp experiments, and more questions,
now at
http://blogs.perl.org/users/yary/2019/08/splitting-on-a-change-in-perl6.html
-y
On Sun, Aug 25, 2019 at 12:55 AM William Michels
wrote:
> Lookahead/lookbehind assertions: maybe the mnemonic "ABBA" will help?
>
> I
Lookahead/lookbehind assertions: maybe the mnemonic "ABBA" will help?
In Markdown:
'Use *A*fter for a look-*B*ehind, use *B*efore for a look-*A*head',
or...
'For a look-*A*head' use *B*efore, for a look-*B*ehind" use *A*fter'.
As a trivial example of the first mnemonic in practice, below are
ex
`after` and `before` can be confusing, but I think it would be more
confusing if it were the other way around.
On Fri, Aug 23, 2019 at 2:15 PM Sean McAfee wrote:
> On Thu, Aug 22, 2019 at 6:11 PM yary wrote:
>
>> Perl 6 is doing the right thing. The dot matches any character. In
>> this case, m
On Thu, Aug 22, 2019 at 6:11 PM yary wrote:
> Perl 6 is doing the right thing. The dot matches any character. In
> this case, matching the final ':'. The next bit of the regex says the
> cursor has to be after 1:, and indeed, after matching the ':' the
> cursor is after '1:', so the substitution
A lookbehind assertion, lookahead assertion, and well every other assertion
are zero width.
That means they do not advance the cursor.
So in the case of `` it asserts that the previous two
characters are `1:`
If that is a true assertion, then nothing happens.
If it is instead false, it causes the
Hi Sean, From the docs:
Lookbehind assertions:
https://docs.perl6.org/language/regexes#Lookbehind_assertions
"To check that a pattern appears after another pattern, use a
lookbehind assertion via the after assertion. This has the form:
"Therefore, to search for the string bar immediately pr
Perl 6 is doing the right thing. The dot matches any character. In
this case, matching the final ':'. The next bit of the regex says the
cursor has to be after 1:, and indeed, after matching the ':' the
cursor is after '1:', so the substitution succeeds.
Maybe you want s//x/ to append 'x' after '1
This seems like a bug, but I thought I'd ask here before reporting it.
$_ = '1:';
s/./x/;
.say;
This prints "1x". Is that what's supposed to happen somehow? I would have
thought that '1:' should only match a literal "1:", leaving nothing for the
dot to match.