# Searching a word

**URL:** <https://www.ruby-forum.com/t/searching-a-word/108723>\
**Category:** Ruby\
**Created:** [July 6, 2007, 11:10am UTC](https://www.ruby-forum.com/t/searching-a-word/108723 "2007-07-06T11:10:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 6, 2007, 11:10am UTC](https://www.ruby-forum.com/t/searching-a-word/108723/1 "2007-07-06T11:10:35Z")

</div>

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

Example:  
new  
hussain.jpg

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

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 6, 2007, 11:33am UTC](https://www.ruby-forum.com/t/searching-a-word/108723/2 "2007-07-06T11:33:07Z")

</div>

> From this example ,i want to get the hussain.jpg  
> can any body tell me  
> Ok
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Try this.

str = “new\nhussain.jpg”  
str =~ /(.\*?)\</image\>/  
p $1

Harry
