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 : [email protected] -
url:http://www.istitutoleonardodavinciaq.191.it
I need to extract the code (XN____01) and the relative email
“[email protected]”, put them in a CSV file or a sort of.
May I do this in ruby?
Thank’s very much for any help and so sorry for my bad english…
On Tue, May 18, 2010 at 7:39 AM, Andrea C.
[email protected] wrote:
I need to extract the code (XN____01) and the relative email
“[email protected]”, 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: Regex Tutorial - Parentheses for Grouping and Capturing
Luis P. wrote:
On Tue, May 18, 2010 at 7:39 AM, Andrea C.
[email protected] wrote:
I need to extract the code (XN____01) and the relative email
“[email protected]”, put them in a CSV file or a sort of.
May I do this in ruby?
You can do it using a capture group:
Ruby Syntax
and examples here: Regex Tutorial - Parentheses for Grouping and Capturing
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.
Thank’s again!
2010/5/18 Andrea C. [email protected]:
Ruby Syntax
and examples here: Regex Tutorial - Parentheses for Grouping and Capturing
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