Re: Right Associative Matching Example (for Docs)

Paolo <[email protected]>
Newsgroups gmane.mail.spam.crm114
Message-ID <20081218210449.GA16870@localhost>
On Thu, Dec 18, 2008 at 10:46:36AM -0700, Chris Babcock wrote:
> >     match (:: :a:) /(?ir:":*:e:".+?"([[:print:]]+?)".+?\n)/
...
>     match (:: :a:) /(?ir:":*:e:".+?"([[:print:]]+?)".*?\n)/

yep, that does match last field - however I get no difference with just
'?i:'; also, simple

  /":*:e:".+?"([[:print:]]+?)".*?\n/

seems to do the job as well, for last non-null-value-in-quotes, whereas
 
  /":*:e:".+?"([[:print:]]+?)".*\n/

would yield the 1st such value after :*:e:.

> The problem is that I was overcompensating for a bad habit. I've been
> trying to break the habit of using * when I mean +. If you don't have a
> comma or some other character at the end of the line then the closing
> quotes go to satisfy the ".+?" and the comma becomes the last 'field'.

unfortunatly CSV isn't that simple to parse - here's eg saved from OOo:

"8,7",0,65,99,"7,22","196,7",01.29,"8,2","NO","0,28","0,12"
"9,8",0,40,76,"8,28","527,9",08.53,"14,2","NNO","0,32","0,14"
"8,4",0,40,61,"7,95","465,4",09.16,"13,9","NNO","0,31","0,14"
"5,8",0,51,91,"6,71","261,3",01.30,"10,5","NO","0,26","0,12"
"5,8",0,51,91,"6"",""709","261,3",01.30,"10,5","NO",,

note unquoted fields and last line, 5th field's value is '6","709' 



-- 
paolo

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.