I'm not sure what output you're hoping for, but there's certainly something odd in the regexp, and I don't think that the code you've posted here produces the output you've posted here. Certainly isn't the case when I try it.

Did you want the final line of output to be this:

(ABE)
If so, you'll need to insert some []s to indicate that A-Z is one of a range of characters and remove some ?s to insist on brackets in the bits of your input you want to substitute. However, I can't commit myself to a final answer until I'm more cetain of what you're after :-)

--
.sig : File not found.


In reply to Re: Interpretation of my output by wol
in thread Interpretation of my output by musa

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.