The first expression deletes any group of spaces that are at least 25 spaces long that are preceded by a |. It also continues deleting anything until it reaches the next |. After the first expression you are left with

'| FIRST LAST NAME| ADDRESS 1 + Interest Rate + 5.450000| CITY STATE ZIPCODE| + Total Payment Amount +$886.00|';

The next expression will remove any set of 25 or 27 or more spaces that are not immediately preceded by a |. It will continue deleting spaces and anything else until it reaches another |. It will delete the spaces after ADDRESS 1, since there are more than 25 of them and keep deleting up to and including 5.450000. Then it will look for another match (/g). There are 25 spaces between CITY and STATE. Those spaces are not immediately preceded by a |. So it will delete those spaces and keep deleting STATE and ZIPCODE until it finds another |. By increasing the 25 to 27, you keep it from matching in this case.


In reply to Re: Negative Lookbehind question by ExReg
in thread Negative Lookbehind question by crusty_collins

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.