[tpm] Regex question
Chris Jones
cj at enersave.ca
Fri Oct 19 18:43:47 PDT 2012
I pull data from long files in that are in a fixed format, ascii report.
For example:
SUPPLY EXHAUST MINIMUM
ZONE FLOW FLOW FAN FLOW
NAME (CFM ) (CFM ) (KW) (FRAC)
Kitchen Area 1C Spc zn 2750. 1400. 0.249 1.000
Kitchen Area 1C Pl zn 0. 0. 0.000 0.000
The Zone names are a max a maximum of 25 characters - spaces
allowed. I want to split the lines into the zone name field and the
4 number fields: I am hoping the first pattern will leave the last
character and remove the trailing spaces up to the maximum of 25
characters (assuming the user would have at least one character in
the zone name.).
I am hoping the following does the trick but I think the first
pattern will end up removing the last character in the zone name:
my @zoneLine = split /[\w\s{0,25)$]/+\w{4}/, $inLine;
At any rate, the above gives me a compile error:
Search pattern not terminated at Test-Split-1.pl line 5.
Any help appreciated!
>>
Christopher Jones, P.Eng.
Suite 1801, 1 Yonge Street
Toronto, ON M5E1W7
Tel. 416-203-7465
Fax. 416-946-1005
email cj at enersave.ca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20121019/80b9182e/attachment.html>
More information about the toronto-pm
mailing list