From: Robert Klemme Date: 2010-05-19T23:23:26+09:00 Subject: Re: Regexp help 2010/5/18 Andrea Carmisciano : > Luis Parravicini wrote: >> On Tue, May 18, 2010 at 7:39 AM, Andrea Carmisciano >> wrote: >>> >>> I need to extract the code (XN____01) and the relative email >>> "ipias_aq@yahoo.it", put them in a CSV file or a sort of. >>> >>> May I do this in ruby? >> >> You can do it using a capture group: >> http://ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/syntax.html#regexp >> and examples here: http://www.regular-expressions.info/brackets.html > > Thank you, but 'couse I'm quiet stupid, can you write me a pseudo-coded > example? For the regex part, not the file open/write part. It's a bit difficult to guess which parts of your line are stable and which not, i.e. how to build the regexp. Can you post, say 5, different lines so we can recognize the pattern? Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/