#!/usr/bin/perl -- use warnings; use strict; use re 'debug'; my $chr = "this and that"; $chr =~ s/(this|that)|(\w+)/$1\U$2/g; #error reported print "$chr\n"; __END__
Compiling REx `(this|that)|(\w+)' size 19 Got 156 bytes for offset annotations. 1: BRANCH(12) 2: OPEN1(4) 4: BRANCH(7) 5: EXACT <this>(10) 7: BRANCH(10) 8: EXACT <that>(10) 10: CLOSE1(19) 12: BRANCH(19) 13: OPEN2(15) 15: PLUS(17) 16: ALNUM(0) 17: CLOSE2(19) 19: END(0) minlen 1 Offsets: [19] 0[0] 1[1] 0[0] 1[1] 2[4] 0[0] 6[1] 7[4] 0[0] 11[1] 0[0] 12[1] 13[1 +] 0[0] 16[1] 14[2] 17[1] 0[0] 18[0] Matching REx `(this|that)|(\w+)' against `this and that' Setting an EVAL scope, savestack=5 0 <> <this and tha> | 1: BRANCH Setting an EVAL scope, savestack=15 0 <> <this and tha> | 2: OPEN1 0 <> <this and tha> | 4: BRANCH Setting an EVAL scope, savestack=25 0 <> <this and tha> | 5: EXACT <this> 4 <this> < and tha> | 10: CLOSE1 4 <this> < and tha> | 19: END Match successful! Matching REx `(this|that)|(\w+)' against ` and that' Setting an EVAL scope, savestack=25 4 <this> < and tha> | 1: BRANCH Setting an EVAL scope, savestack=35 4 <this> < and tha> | 2: OPEN1 4 <this> < and tha> | 4: BRANCH Setting an EVAL scope, savestack=45 4 <this> < and tha> | 5: EXACT <this> failed... 4 <this> < and tha> | 8: EXACT <that> failed... Clearing an EVAL scope, savestack=35..45 4 <this> < and tha> | 13: OPEN2 4 <this> < and tha> | 15: PLUS ALNUM can match 0 times out of 2147483647.. +. Setting an EVAL scope, savestack=35 failed... Clearing an EVAL scope, savestack=25..35 Setting an EVAL scope, savestack=25 5 <this > <and tha> | 1: BRANCH Setting an EVAL scope, savestack=35 5 <this > <and tha> | 2: OPEN1 5 <this > <and tha> | 4: BRANCH Setting an EVAL scope, savestack=45 5 <this > <and tha> | 5: EXACT <this> failed... 5 <this > <and tha> | 8: EXACT <that> failed... Clearing an EVAL scope, savestack=35..45 5 <this > <and tha> | 13: OPEN2 5 <this > <and tha> | 15: PLUS ALNUM can match 3 times out of 2147483647.. +. Setting an EVAL scope, savestack=35 8 <his and> < that> | 17: CLOSE2 8 <his and> < that> | 19: END Match successful! Use of uninitialized value in concatenation (.) or string at 2 line 9. Matching REx `(this|that)|(\w+)' against ` that' Setting an EVAL scope, savestack=35 8 <his and> < that> | 1: BRANCH Setting an EVAL scope, savestack=45 8 <his and> < that> | 2: OPEN1 8 <his and> < that> | 4: BRANCH Setting an EVAL scope, savestack=55 8 <his and> < that> | 5: EXACT <this> failed... 8 <his and> < that> | 8: EXACT <that> failed... Clearing an EVAL scope, savestack=45..55 8 <his and> < that> | 13: OPEN2 8 <his and> < that> | 15: PLUS ALNUM can match 0 times out of 2147483647.. +. Setting an EVAL scope, savestack=45 failed... Clearing an EVAL scope, savestack=35..45 Setting an EVAL scope, savestack=35 9 <his and > <that> | 1: BRANCH Setting an EVAL scope, savestack=45 9 <his and > <that> | 2: OPEN1 9 <his and > <that> | 4: BRANCH Setting an EVAL scope, savestack=55 9 <his and > <that> | 5: EXACT <this> failed... 9 <his and > <that> | 8: EXACT <that> 13 <his and that> <> | 10: CLOSE1 13 <his and that> <> | 19: END Match successful! String too short [regexec_flags]... Match failed Freeing REx: `"(this|that)|(\\w+)"'

In reply to Re: why such an error happened? by Anonymous Monk
in thread why such an error happened? by lightoverhead

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.