Splitting OR Regex

From: Joshua Scott (Joshua.Scott_at_jacobs.com)
Date: 10/31/03


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.

==============================================================================



Relevant Pages

  • Re: Re: Haeckel is still relevant
    ... portions that you wanted from that thread. ... perhaps you could show us the quotes that demonstrate he owes you the ... money, or link to the thread from google. ...
    (talk.origins)
  • Re: Splitting OR Regex
    ... > portions between quotes together? ... This is a FAQ: ... perldoc -q delimit ...
    (perl.beginners)
  • Re: Haeckel is still relevant
    ... portions that you wanted from that thread. ... perhaps you could show us the quotes that demonstrate he owes you the ... money, or link to the thread from google. ...
    (talk.origins)