[IWE] Gruesome Perl Regular Expression Problem
Thu, 1 Dec 2005 09:32:40 -0000
Here's a record from my data that I want to process:
0, ! Additional Sites \
1, ! Adjacent Sites \
2, ! Downstream Sites \
N, ! Partial Closures Prohibited \
1, ! Upstream Sites \
As you can see, it's a rather obscure counted format.
I need to produce a report of which of these records has the partial
closures prohibited flag set to Y.
I'm cool with multiline and extended regexes, and I've got the matching for
the individual bits down pat.
What I'm struggling to find in the documentation is how to extract the
number of sites then match that number of sites before matching the next bit
of the record.
How do I match the digit then use the value of the digit to match a number
Site Data & Test Engineer, Serco Integrated Transport
voice: 01642 636943 fax: 01642 636701 ext: 6943
Serco Integrated Transport, Web Site: www.serco.com/sit -
This message, including attachments, is intended only for the use by the
person(s) to whom it is addressed. It may contain information which is
privileged and confidential. Copying or use by anybody else is not
authorised. If you are not the intended recipient, please contact the sender
as soon as possible. The views expressed in this communication may not
necessarily be the views held by Serco Integrated Transport.