In message <Pine.LNX.4.21.0112211214250.20755-100000 / crimson.propagation.net>
ale / crimson.propagation.net writes:

> you can code something like
> 
>   class String
>     def matches?(pattern)
>       pattern = pattern.gsub(/\./, '\.')
>       pattern = pattern.gsub(/\?/, ".")
>       pattern = pattern.gsub(/\*/, ".*?")
>       re = Regexp.new(pattern)
>       re.match(self) != nil
>     end
>   end
> 
>   p "filename.txt".matches? "*.txt"
>   p "foo.bor".matches? "f?o.b?r"

....And near future, 1.8 released, we have File.fnmatch? which does
fnmatch(3).  It's already in 1.7.x branch, so this prediction is
almost already true :-)


-- 
kjana / dm4lab.to                              December 22, 2001
Shortest way may be longest way.