Hi

I think the X is to prevent the regex from matching. Isn't there a better way to do that?

That is a good observation

Maybe, there are http://perldoc.perl.org/perlre.html#Verbs for that, more on this at the end of this post

Taking a second look at output of (??{ versus (?{

v5.16.1
[1 3] [3 8] [8 14] DELETED:[1 3 8 ] REMAINS:[14 19 26 33 ] [14 19] [19 26] DELETED:[14 19 ] REMAINS:[26 33 ] [26 33] DELETED:[26 ] REMAINS:[33 ] NUMBERS:[1:33 ] ----------
[1 3] DELETED:[1 ] REMAINS:[3 8 14 19 26 33 ] [3 8] DELETED:[3 ] REMAINS:[8 14 19 26 33 ] [8 14] DELETED:[8 ] REMAINS:[14 19 26 33 ] [14 19] DELETED:[14 ] REMAINS:[19 26 33 ] [19 26] DELETED:[19 ] REMAINS:[26 33 ] [26 33] DELETED:[26 ] REMAINS:[33 ] NUMBERS:[1:33 ] ----------

v5.18.2
[1 3] DELETED:[1 ] REMAINS:[3 8 14 19 26 33 ] [3 8] DELETED:[3 ] REMAINS:[8 14 19 26 33 ] [8 14] DELETED:[8 ] REMAINS:[14 19 26 33 ] [14 19] DELETED:[14 ] REMAINS:[19 26 33 ] [19 26] DELETED:[19 ] REMAINS:[26 33 ] [26 33] DELETED:[26 ] REMAINS:[33 ] NUMBERS:[1:33 ] ----------
[1 3] [3 8] [8 14] DELETED:[1 3 8 ] REMAINS:[14 19 26 33 ] [14 19] [19 26] DELETED:[14 19 ] REMAINS:[26 33 ] [26 33] DELETED:[26 ] REMAINS:[33 ] NUMBERS:[3:""33 ] ----------

As you can see all three versions end the final result of

NUMBERS:[1:33 ]
they just get there by different order of add/delete, not sure how important this is

Only the crashing/buggy version returns something different when its able to complete under -Mre=debug

Now back to verbs, using

$2 - $1 <= $c ? '(*FAIL)' : '(*ACCEPT)'
makes it fail in the exact same way, which is not too surprising

Using *PRUNE or $2 - $1 <= $c ? '(*SKIP)' : '(*ACCEPT)' and its just like using (?{


In reply to Re^3: Can't coerce UNKNOWN to string in substitution iterator (splain, (??{})) by beech
in thread Can't coerce UNKNOWN to string in substitution iterator by rsFalse

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.