[tpm] Regex question
Fulko Hew
fulko.hew at gmail.com
Fri Oct 19 19:04:15 PDT 2012
On Fri, Oct 19, 2012 at 9:43 PM, Chris Jones <cj at enersave.ca> wrote:
> 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;
>
my guess would be that this slash ^
shouldn't be there
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20121019/43f39fe2/attachment-0001.html>
More information about the toronto-pm
mailing list