0

Is there a way to check and see if a string matches a Dir.glob pattern?

Eg if '/foo/bar/baz.jpg' matches '*.{jpg,png}'

Tal
  • 1,298
  • 2
  • 10
  • 20
  • 4
    Yes: http://stackoverflow.com/questions/7186361/how-do-i-test-whether-a-string-would-match-a-glob-in-ruby – Casper Jan 02 '17 at 23:55
  • Or, just go directly to the docs for [File.fnmatch](https://ruby-doc.org/core-2.3.0/File.html#method-c-fnmatch) for a more detailed description and lots of examples. – 7stud Jan 03 '17 at 00:15

0 Answers0