From: Brian Wallace Date: 2009-04-22T03:58:24+09:00 Subject: Re: directory watcher, trying to match filename to directory name. --00151750d89c2a448f0468153b51 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I agree, not a good assumption in most cases - and its a bit wasteful since i'm creating an array of globs with elements that will never match (ie: a file with a single name in C:\send will never match unless a directory exists with the same name, and the same file under it) This is good though, thank you - just seeing these regex's in use helps me understand them.. Thanks, Brian On Tue, Apr 21, 2009 at 2:46 PM, Hassan Schroeder < hassan.schroeder@gmail.com> wrote: > On Tue, Apr 21, 2009 at 11:28 AM, Brian Wallace > wrote: > > I do realize this :) , but if I could at least assume that "STRING" > without > > the .??? is a directory, it would suffice ... Since the application will > run > > in Windows there's less of a chance that a file called "STRING" would be > > placed into the list. > > Still a dicey assumption, IMO, but > > > So a RegEx that matches anything up to the '.' file extension and > excludes > > '.' and '..' would be enough > > Something like > > irb(main):017:0> puts "wow" if /^[\w]+$/.match("foobar") > wow > => nil > irb(main):018:0> puts "wow" if /^[\w]+$/.match("foo.bar") > => nil > irb(main):019:0> > > HTH! > -- > Hassan Schroeder ------------------------ hassan.schroeder@gmail.com > > --00151750d89c2a448f0468153b51--