From: Luis Parravicini Date: 2010-05-18T20:37:28+09:00 Subject: Re: Regexp help On Tue, May 18, 2010 at 7:39 AM, Andrea Carmisciano wrote: > Hi, I'm newbie to ruby, but I try searching a lot for my problem... > > I need to extract from an enormous text file, in natural language, for > two separated element in the same line and put them in a new file. > > Example: > IIS - IPSIASAR L. DA VINCI (XN____01) - Responsabile: ENRICO FLAIANO > VIA MONTE S. ROCCO, 15 PINETA SIGNORINI - 67100 L'AQUILA (AQ) - tel. > 0862 22112 - fax. 0862 22300            email : ipias_aq@yahoo.it - > url:http://www.istitutoleonardodavinciaq.191.it > > 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 -- Luis Parravicini http://ktulu.com.ar/blog/