develooper Front page | perl.perl5.porters | Postings from November 2013

[perl #120600] Variable length lookbehind is not variable

Thread Next
From:
Adrian
Date:
November 20, 2013 19:38
Subject:
[perl #120600] Variable length lookbehind is not variable
Message ID:
rt-4.0.18-4747-1384974734-1561.120600-75-0@perl.org
# New Ticket Created by  Adrian 
# Please include the string:  [perl #120600]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=120600 >


The following code works:

  #!/usr/bin/perl
  ($_) = "abcdef" =~
  /
    ((?&BB).*)
  | (?!)
    (?<W>[abc])
    (?<NW>[^abc])
    (?<BB>
        (?<=[abc])(?=[^abc])
      | (?<=[^abc])(?=[abc])
    )
  /x;
  print;

The following equivalent code does not:

  #!/usr/bin/perl
  ($_) = "abcdef" =~
  /
  ((?&BB).*)
  |
    (?!)
    (?<W>[abc])
    (?<NW>[^abc])
    (?<BB>
       (?<=(?&W))(?=(?&NW))
      |(?<=(?&NW))(?=(?&W))
    )
  /x;
  print;

Why is the named pattern being treated as a variable length pattern?

Thanks,


Adrian Hawryluk


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About