From: Robert Klemme Date: 2008-12-07T20:08:44+09:00 Subject: Re: Proximity searches in Ruby On 06.12.2008 14:30, Robert Dober wrote: > On Sat, Dec 6, 2008 at 2:06 PM, Michael Fellinger wrote: >>> File::read("test.data").scan %r{Hello.{0,10}World}im >> That would be 10 characters > Huh?? I guess Michael's point was that your version is not a scaled down version of mine because it defines "proximity" differently: your version uses character count while my version uses word count. Another difference is that in your case order matters. Here's an attempt to fix both: # untested s.scan %r{ \b (?: hello\W+(?:\w+\W+){0,10}world | world\W+(?:\w+\W+){0,10}hello ) \b }mix Cheers robert