I think its a bug like Bug #75644 for Regexp-Grammars: debug does not work

You can workaround by following http://search.cpan.org/src/DCONWAY/Regexp-Grammars-1.016/t/backref.t and http://search.cpan.org/src/DCONWAY/Regexp-Grammars-1.016/t/backref_ARG.t, which DO NOT test this (your) example from the docs

The workaround does work

#!/usr/bin/perl -- use strict; use warnings; use Data::Dumper; my $grammar = do { use Regexp::Grammars; qr{ <debug:on> <delimited_string> <token: delimited_string> <delim=(['"`])> <content=(.*?)> <rdel=\delim> }xms; }; my $string = "'hi'"; if ($string =~ $grammar) { print Dumper \%/; } __END__ =====> Trying <grammar> from position 0 'hi' |...Trying <delimited_string> | |...Trying <delim=(['"`])> hi' | | \_____<delim=(['"`])> matched ''' | |...Trying <content=(.*?)> | | \_____<content=(.*?)> matched '' | |...Trying <rdel=\delim> | | \FAIL <rdel=\delim> i' | | \_____<content=(.*?)> matched 'h' | |...Trying <rdel=\delim> | | \FAIL <rdel=\delim> ' | | \_____<content=(.*?)> matched 'hi' | |...Trying <rdel=\delim> [eos] | | \_____<rdel=\delim> matched ''' | \_____<delimited_string> matched ''hi'' \_____<grammar> matched ''hi'' $VAR1 = { '' => '\'hi\'', 'delimited_string' => { '' => '\'hi\'', 'content' => 'hi', 'delim' => '\'', 'rdel' => '\'' } };

Regexp::Grammars::Common::String use this syntax

You should report this bug upstream , maybe write this example as a test case following t/backref*


In reply to Re: The usage of <ALIAS=\IDENT> of Regexp::Grammars by Anonymous Monk
in thread The usage of <ALIAS=\IDENT> of Regexp::Grammars by 0FGVYqxHQZ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.