From: Peter Bailey Date: 2006-11-27T23:37:34+09:00 Subject: Re: A directory "grep" in RUBY? Robert Klemme wrote: > On 24.11.2006 15:38, Peter Bailey wrote: >> Hi, >> Can someone point me to a quick "grep" like function in RUBY? I use glob >> all the time, but, I need the power of regular expressions when finding >> particular files in directories. I see "grep" in the Pickaxe manual, >> but, only as it relates to ".enum," which, sorry to say, I don't >> understand. >> >> I need something like this, even though, I know this doesn't work: >> Dir.glob(/^f[0-9]{7}\.eps/) > > Dir.glob('f*.eps').grep(/^f[0-9]{7}\.eps$/) > > There's plenty more options around. > > robert Grepping on a glob. That makes sense. I knew that grep could be used somehow. Thanks, Robert. -- Posted via http://www.ruby-forum.com/.