On Jan 8, 2008, at 11:39 PM, Nanyang Zhan wrote:

> Hi, Could anyone tell me how to generate regexp pattern from strings?
>
> for example, how to code the return_pattern(str) method?
> thanks!
>
> str = "^test|production-(\\d+)"
> return_pattern(str) ===> /^test|production-(\d+)/
>
> def return_pattern(str)
> ?????????????????
> end
> --  
> Posted via http://www.ruby-forum.com/.
>

Regexp.escape string

a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being  
better. simply reflect on that.
h.h. the 14th dalai lama