Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Negative Lookbehind question

by ExReg (Priest)
on Nov 11, 2015 at 21:31 UTC ( [id://1147505]=note: print w/replies, xml ) Need Help??


in reply to Negative Lookbehind question

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1147505]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-19 10:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found