Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!caen!uwm.edu!lll-winken!sun-barr!newstop!texsun!smunews!necssd!harrison From: harrison@necssd.NEC.COM (Mark Harrison) Newsgroups: comp.lang.perl Subject: newbie question on split Keywords: need a regular expression Message-ID: <781@necssd.NEC.COM> Date: 18 Apr 91 00:23:46 GMT Reply-To: harrison@csl.dl.nec.com Organization: NEC America Inc. SSD, Irving, TX Lines: 21 I would like to split a line into fields, where fields are separated by whitespace. If a field contains whitespace, It should be enclosed in double quotes. If a field needs a double quote, it should backslash escape it. EG, field1 field2 field3 field1 "field 2" "field \"3\"" What I have now: ($key, $str, $cmd) = split("[ \t]+"); 1. What RE should I use for handling double quotes? 2. What RE should I use for handling double quotes with embedded quotes? 3. Is there a better way to do this? Thanks in advance... -- Mark Harrison harrison@ssd.dl.nec.com (214)518-5050 {necntc, cs.utexas.edu}!necssd!harrison standard disclaimers apply...