From: Kioko -- Date: 2009-09-06T01:05:55+09:00 Subject: How to convert a "normal" searchstring into regexp Hi there, I'm really new to Ruby and I hope I didn't overlook something while searching through forums and docs but I got a small problem which I can't solve myself... :( As many users aren't familiar with regexp I need something different to match a string. e.g. I would like "my.li??le.searchstri*g\?" to match against "my.little.searchstring?" (so input is a "normal" searchstring which would be familiar to all users) I didn't find a method which do some matching work except Regexp's match My solution now was to "convert" the searchstring into a regexp like "^my\.li..le\.searchstri.*g\?$" However, after hours of working, I was unable to code something like that. My idea was to "Regexp.escape(searchstring)" it first and than replace "\?" with "." and "\*" with ".*" and so on (horrible, isn't it?) It would really appreciate it, if someone could give me some hints how to solve it more easier or even if there is something in Ruby I didn't see yet. Thanks for reading. Noxx -- Posted via http://www.ruby-forum.com/.