Dear AnomalousMonk, one thing is for sure, you are obviously the most helpful Monk in this forum with a great heart and a lot of patience with someone like me, who makes one mistake after the other. I have studied your replies, but I had difficulties in understanding the real meaning of $pre and also the $post, partly because this new form of writing a regex is new for me, in the book I have read about regex, this form with the modifier x (which is clearly more readable then the old form) was not used. Also the use of { instead of / was at first glance a little confusing for me. As you wisely have stated, I should have tried harder to learn fishing and not only to consume a fish. In my OP I have abreviated my data so to make my question short, not understanding that this changed the problem.

Concerning the space in the $pre, I have just overlooked the space betweeen FEN and the ". Concerning the $post, in my real data there is leading whitespace before the 'Weiss' line, but in the testfile I have deleted it, for the same reason as before, I wanted to be short.

After so many mistakes which I have made I have studied your solution more thoroughly and now I think I have understood it. At last, I have learned a little bit to fish. But when you are 72 years old, it's not so easy and I must confess that I have only studied in books the parts, which I think were needed to solve my problems.

Once again, many thanks for your great help


In reply to Re^4: Regex with condition by OldChamp
in thread Regex with condition by OldChamp

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.