Well, here's a hint to get you started:

c:\@Work\Perl\monks>perl -wMstrict -le "use YAPE::Regex::Explain; ;; print YAPE::Regex::Explain->new(qr{ (?: [|] [^|]*){4} \z }xms)->expla +in; " The regular expression: (?msx-i: (?: [|] [^|]*){4} \z ) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?msx-i: group, but do not capture (with ^ and $ matching start and end of line) (with . matching \n) (disregarding whitespace and comments) (case-sensitive): ---------------------------------------------------------------------- (?: group, but do not capture (4 times): ---------------------------------------------------------------------- [|] any character of: '|' ---------------------------------------------------------------------- [^|]* any character except: '|' (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ){4} end of grouping ---------------------------------------------------------------------- \z the end of the string ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
But it's difficult to answer questions you haven't asked. Again, please see perlre, perlretut, and perlrequick. (In particular, perlretut has a lot of info. And all this on-line documentation is available at your local command line via  perldocperlretut   and etc.) Also, please see the articles in the Pattern Matching, Regular Expressions, and Parsing section of the Monastery Tutorials; some of them may address your questions. All this stuff is free, but there are some good book$ out there if you want some recommendations. davido has a nice regex exerciser; see his personal node for a link. I and others will be very happy to answer your questions, but please try to make them as specific as possible.


Give a man a fish:  <%-{-{-{-<


In reply to Re^7: how to remove a string from end of a line by AnomalousMonk
in thread how to remove a string from end of a line by rpinnam

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.