Find patter matching : fnmatch « File Directory « Ruby






Find patter matching


File.fnmatch("*.rb", "hello.rb")     # => true
File.fnmatch("*.[ch]", "ruby.c")     # => true
File.fnmatch("*.[ch]", "ruby.h")     # => true
File.fnmatch("?.txt", "ab.txt")      # => false

 








Related examples in the same category

1.File name matching with flags