Parsing of Html/Text files

Hi Guyz, back with a new problem :slight_smile:

Actually the situation is that i have a txt file or can be html file. In
that file the contents are written as:-
Model Name:- ABC
Item Name :- ABC

There are hundreds of lines for it. Now, i am matching these line and
where ever i'll find the line model name. I'll get it. So right now i am
doing it as,
if file_line.match("Model Name") .. Is there any other way to do it
using parsers? I mean using Hpricot or else .. want to know every
possible way to do this.

Thanks

路路路

--
Posted via http://www.ruby-forum.com/.

When that text is contained in a HTML file, is it alawys enclosed in the same
HTML tag?

路路路

El Lunes, 4 de Enero de 2010, Hemant Bhargava escribi贸:

Hi Guyz, back with a new problem :slight_smile:

Actually the situation is that i have a txt file or can be html file. In
that file the contents are written as:-
Model Name:- ABC
Item Name :- ABC

There are hundreds of lines for it. Now, i am matching these line and
where ever i'll find the line model name. I'll get it. So right now i am
doing it as,
if file_line.match("Model Name") .. Is there any other way to do it
using parsers? I mean using Hpricot or else .. want to know every
possible way to do this.

--
I帽aki Baz Castillo <ibc@aliax.net>

I am not using any tags for text. Ok leave html part. Help me only with
text file. :slight_smile:

I帽aki Baz Castillo wrote:

路路路

El Lunes, 4 de Enero de 2010, Hemant Bhargava escribi贸:

if file_line.match("Model Name") .. Is there any other way to do it
using parsers? I mean using Hpricot or else .. want to know every
possible way to do this.

When that text is contained in a HTML file, is it alawys enclosed in the
same
HTML tag?

--
Posted via http://www.ruby-forum.com/\.

Then using pure regex is good enough. If you want something "cooler" try
TreeTop parser (very friendly and powerful).

路路路

El Lunes, 4 de Enero de 2010, Hemant Bhargava escribi贸:

I am not using any tags for text. Ok leave html part. Help me only with
text file. :slight_smile:

--
I帽aki Baz Castillo <ibc@aliax.net>