Re: Right Associative Matching Example (for Docs)
Paolo <[email protected]>
| Newsgroups | gmane.mail.spam.crm114 |
|---|---|
| Message-ID | <20081218140246.GA13773@localhost> |
On Thu, Dec 18, 2008 at 04:15:55AM -0700, Chris Babcock wrote: > Use right associative matching when working with tabular data and you > want to match columns near the end of the line. For example, parsing a > CSV file with /(?i:":*:email:".+?"([[:print:]]+?)".+?\n)/ matches the > column after :email: while /(?ir:":*:email:".+?"([[:print:]]+?)".+?\n)/ > matches the last column on the line. what's the wanted result here? I get: $ cat /tmp/csv.csv "1","a","[email protected]","uno","due","tre" "2","b","[email protected]","uno","due","tre" "3","c","[email protected]","uno","due","tre" $ crm '-{isolate (:e:) /[email protected]/ match (:: :a:) /(?ir:":*:e:".+?"([[:print:]]+?)".+?\n)/ output /a=:*:a:\n/ }' < /tmp/csv.csv a=, $ crm '-{isolate (:e:) /[email protected]/ match (:: :a:) /(?i:":*:e:".+?"([[:print:]]+?)".+?\n)/ output /a=:*:a:\n/ }' < /tmp/csv.csv a=, not very meaningful to me. thx -- 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/