in reply to Remove Tabs and white space from a line except in Quotes

If you're not interested in backslash processing, this works, albeit not particularly efficiently:

  s{ [ \t]* ( (?: " .*? " )? ) }{$1}xg;

    -- Chip Salzenberg, Free-Floating Agent of Chaos

Replies are listed 'Best First'.
Re: Re: Remove Tabs and white space from a line except in Quotes
by SmokeyB (Scribe) on Jun 26, 2003 at 15:56 UTC
    Thanks bro! This is a great start! Everyone else too, those suggestions will put me on the right track! Cheers!
Re: Re: Remove Tabs and white space from a line except in Quotes
by SmokeyB (Scribe) on Jun 26, 2003 at 18:10 UTC
    EDITED: Do you know what, I made a mistake. There is still some problems with what I posted, but I didn't realize it in time. Please ignore this! Hey Again, I took what you started with, and I modified it to account for backslash quotes and came up with this:
    s/[ \t]*((?:"(?:(?>[^\\"]*)).*")?)/$1/xg;
    It works just the way I want it to! I don't know how efficient it is, but it does the job. My next stumper is how to incorporate single quotes in as well? Any thoughts?