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
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
However, after hours of working, I was unable to code something like
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
Thanks for reading.