[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Searching a word

Mohamed Hussain

7/6/2007 9:11:00 AM

Hai
I want to search a word in the xml file using ruby
I dont know , how to do that.

Example:
<name>new</name>
<image>hussain.jpg</image>


From this example ,i want to get the hussain.jpg
can any body tell me
Ok

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

1 Answer

Harry Kakueki

7/6/2007 9:32:00 AM

0

> From this example ,i want to get the hussain.jpg
> can any body tell me
> Ok
>
> --
> Posted via http://www.ruby-....
>
>
Try this.


str = "<name>new</name>\n<image>hussain.jpg</image>"
str =~ /<image>(.*?)<\/image>/
p $1

Harry

--
A Look into Japanese Ruby List in English
http://www.ka...