Splitting OR Regex
From: Joshua Scott (Joshua.Scott_at_jacobs.com)
Date: 10/31/03
- Next message: Sudarshan Raghavan: "Re: Reading a directory and Renaming the file"
- Previous message: Art Mahanna: "watch out for virus masquerading as Microsoft"
- Next in thread: Tore Aursand: "Re: Splitting OR Regex"
- Reply: Tore Aursand: "Re: Splitting OR Regex"
- Reply: Rob Dixon: "Re: Splitting OR Regex"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: beginners@perl.org Date: Thu, 30 Oct 2003 23:37:55 -0500
Hello,
How can I split the data in a line by a single whitespace but also keep
portions between quotes together? Here is an example of a line of data I'm
trying to parse:
id=firewall time="2003-10-30 04:15:01" fw=66.74.67.229 pri=5 c=256 m=38
msg="ICMP packet dropped" n=63211 src=1.1.1.1 dst=2.2.2.2
What I would like to do is keep the data between the quotes together despite
the spaces. This is what I'm expecting to get:
Id=firewall
Time="2003-10-30 04:15:01"
Fw=66.74.67.229
Msg="ICMP packet dropped"
...etc
How should I go about doing this? What I have currently is a regex that
splits out the entire line, but certain fields have changed so my original
code doesn't work as well.
Thank you very much!
Joshua Scott
==============================================================================
NOTICE - This communication may contain confidential and privileged
information that is for the sole use of the intended recipient. Any viewing,
copying or distribution of, or reliance on this message by unintended
recipients is strictly prohibited. If you have received this message in
error, please notify us immediately by replying to the message and deleting
it from your computer.
==============================================================================
- Next message: Sudarshan Raghavan: "Re: Reading a directory and Renaming the file"
- Previous message: Art Mahanna: "watch out for virus masquerading as Microsoft"
- Next in thread: Tore Aursand: "Re: Splitting OR Regex"
- Reply: Tore Aursand: "Re: Splitting OR Regex"
- Reply: Rob Dixon: "Re: Splitting OR Regex"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|