# Search

**URL:** <https://www.ruby-forum.com/t/search/107224>\
**Category:** Ruby\
**Created:** [June 19, 2007, 11:49am UTC](https://www.ruby-forum.com/t/search/107224 "2007-06-19T11:49:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![geetha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f08c70/32.png) [@geetha](https://www.ruby-forum.com/u/geetha)\
**Post date:** [June 19, 2007, 11:49am UTC](https://www.ruby-forum.com/t/search/107224/1 "2007-06-19T11:49:06Z")

</div>

Hi,

I need to implment the search using Ruby . The search word is more than  
one  
means my program getting problem.  
How can I solve that.  
For example ,

```
I am having one file . In that file more than 100 lines are there.

```

I have to search some three words . The first two words there in first  
line  
and the another one word is there in  
another one line means How can I match that 3 words.

Please any one help me…

Geetha.

---

<div class="post-metadata">

**Author:** ![geetha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f08c70/32.png) [@geetha](https://www.ruby-forum.com/u/geetha)\
**Post date:** [June 20, 2007, 8:12am UTC](https://www.ruby-forum.com/t/search/107224/2 "2007-06-20T08:12:18Z")

</div>

> ```
> I am having one file . In that file more than 100 lines are there.
> 
> ```
> 
> I have to search some three words . The first two words there in first  
> line  
> and the another one word is there in  
> another one line means How can I match that 3 words.

Why don’t you try ruby regexp?

---

<div class="post-metadata">

**Author:** ![geetha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f08c70/32.png) [@geetha](https://www.ruby-forum.com/u/geetha)\
**Post date:** [June 20, 2007, 1:58pm UTC](https://www.ruby-forum.com/t/search/107224/3 "2007-06-20T13:58:25Z")

</div>

I tried your concept. But it wont escape the special character what the  
regexp return.  
For example ,

“widely implemented” is my search string , the regular expression return  
like  
(?-mix:widely\\s+ ).

So while the time of matching it had a problem.  
So I am working on that.
