FAQ

On 2014-02-21 02:23, Nathan Trapuzzano wrote:
demerphq <demerphq@gmail.com> writes:
FWIW, a quick looks suggests that the following patch should work.
However it causes various tests to fail, and I have not had time to
dig deeper.
I think I found another problem:

print 'abcb' =~ /^(.\2?)(.)(?1)$/ ? "true\n" : "false\n"
=> false

print 'abcb' =~ /^(.(?{ printf "%d, $2\n", pos()})\2?)(.)(?1)$/ ? "true\n" : "false\n"
=> 1,
=> 3, b
=> false

The second is the same as the first except for the added diagnostics.
to help show what's going on. Why does this fail? Is there some logic
that says that forward backreferences always fail? The diagnostics show
that we're about to try to match 'b' at pos 3, which should succeed.
$ perl -wE'
      say "aba" =~ /\1.(.)/ ? "YES" : "no";
'
no

$ perl -wE'
      say "aba" =~ /(.).\1/ ? "YES" : "no";
'
YES


If it would match, then it can be used for 'scenario' cases, like

    /(?:\1|\2).(.)(.)/

--
Ruud

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 7 of 39 | next ›
Discussion Overview
groupperl5-porters @
categoriesperl
postedFeb 16, '14 at 12:30p
activeFeb 26, '14 at 10:24a
posts39
users6
websiteperl.org

People

Translate

site design / logo © 2021 Grokbase