Your code does not compile:
  1. missing semicolon at line 1
  2. too many closing curly brackets

And, your code would not produce the output you assert even were those errors corrected. Perhaps the most trivial issue is that your line four would print a dot between the value of $_ and the newline, since you've quoted the entire output, not just the \n. But frankly, I can't even think of a way, off-hand, that any plausible typo in your posting would produce the alleged output

Based on your comments, I'm guessing that you believed the vertical_bar amounts to an or in your regex. It can represent "or" but not in the manner you've presented it. perldoc perlretut may help you on that.

An alternate might be that the bar is a typo for the numeral, "1." but even that would never cause the code you've presented to produce the output you posted.

What you've presented asks the regex engine to match:

a single character, "A"
a string, "BC|" (which is to be captured)
followed by a "D"
      as many times as possible
      (which is none, nil, never.)
So what did you really mean? What code (if any) actually produced the output you quote?

In reply to Re: how to make // not return what is in a parenthesis? by ww
in thread how to make // not return what is in a parenthesis? by beanryu

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.