regular expressions and a text file


Subject: regular expressions and a text file
From: Mike Barsalou (mbarsalou@aidea.org)
Date: Fri Aug 23 2002 - 11:58:00 AKDT


We have a text file we are trying to parse....each data item is separated by
a tab...sometimes.

Is there regular expression I can use that would swallow up all of the tabs
and whitespaces? Will it work in the split command? or will I have to
process the line first, then hand it to the split command?

For example the data looks like:

data1\t\tdata2\t data3 data4

And the combinations of tabs and spaces is not consistent from line to line
(what a nightmare).

We tried using

split(/\s/,$line);

But this didn't do what we expected...we were hoping the \s would swallow
all of the whitespace characters.

Mike

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Fri Aug 23 2002 - 12:00:37 AKDT