D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
File
/
Filename :
fnmatch-c.ri
back
Copy
U:RDoc::AnyMethod[iI"fnmatch:ETI"File::fnmatch;TT:publico:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph; [I"MReturns true if +path+ matches against +pattern+. The pattern is not a ;TI"Lregular expression; instead it follows rules similar to shell filename ;TI"<globbing. It may contain the following metacharacters:;To:RDoc::Markup::BlankLine o:RDoc::Markup::List: @type: NOTE:@items[o:RDoc::Markup::ListItem:@label[I"<code>*</code>;T; [ o; ; [I"FMatches any file. Can be restricted by other values in the glob. ;TI"0Equivalent to <code>/.*/x</code> in regexp.;T@o;; ;;[ o;;[I"<code>*</code>;T; [o; ; [I"Matches all regular files;To;;[I"<code>c*</code>;T; [o; ; [I"4Matches all files beginning with <code>c</code>;To;;[I"<code>*c</code>;T; [o; ; [I"1Matches all files ending with <code>c</code>;To;;[I"<code>\*c*</code>;T; [o; ; [I"8Matches all files that have <code>c</code> in them ;TI")(including at the beginning or end).;T@o; ; [I"FTo match hidden files (that start with a <code>.</code>) set the ;TI"File::FNM_DOTMATCH flag.;T@o;;[I"<code>**</code>;T; [o; ; [I":Matches directories recursively or files expansively.;T@o;;[I"<code>?</code>;T; [o; ; [I"LMatches any one character. Equivalent to <code>/.{1}/</code> in regexp.;T@o;;[I"<code>[set]</code>;T; [o; ; [I"NMatches any one character in +set+. Behaves exactly like character sets ;TI"=in Regexp, including set negation (<code>[^a-z]</code>).;T@o;;[I"<code>\\</code>;T; [o; ; [I"$Escapes the next metacharacter.;T@o;;[I"<code>{a,b}</code>;T; [o; ; [I"KMatches pattern a and pattern b if File::FNM_EXTGLOB flag is enabled. ;TI"8Behaves like a Regexp union (<code>(?:a|b)</code>).;T@o; ; [I"M+flags+ is a bitwise OR of the <code>FNM_XXX</code> constants. The same ;TI"2glob pattern and flags are used by Dir::glob.;T@o; ; [I"Examples:;T@o:RDoc::Markup::Verbatim; [0I"MFile.fnmatch('cat', 'cat') #=> true # match entire string ;TI"SFile.fnmatch('cat', 'category') #=> false # only match partial string ;TI" ;TI"eFile.fnmatch('c{at,ub}s', 'cats') #=> false # { } isn't supported by default ;TI"fFile.fnmatch('c{at,ub}s', 'cats', File::FNM_EXTGLOB) #=> true # { } is supported on FNM_EXTGLOB ;TI" ;TI"TFile.fnmatch('c?t', 'cat') #=> true # '?' match only 1 character ;TI"?File.fnmatch('c??t', 'cat') #=> false # ditto ;TI"XFile.fnmatch('c*', 'cats') #=> true # '*' match 0 or more characters ;TI"?File.fnmatch('c*t', 'c/a/b/t') #=> true # ditto ;TI"VFile.fnmatch('ca[a-z]', 'cat') #=> true # inclusive bracket expression ;TI"cFile.fnmatch('ca[^t]', 'cat') #=> false # exclusive bracket expression ('^' or '!') ;TI" ;TI"OFile.fnmatch('cat', 'CAT') #=> false # case sensitive ;TI"QFile.fnmatch('cat', 'CAT', File::FNM_CASEFOLD) #=> true # case insensitive ;TI"fFile.fnmatch('cat', 'CAT', File::FNM_SYSCASE) #=> true or false # depends on the system default ;TI" ;TI"jFile.fnmatch('?', '/', File::FNM_PATHNAME) #=> false # wildcard doesn't match '/' on FNM_PATHNAME ;TI"EFile.fnmatch('*', '/', File::FNM_PATHNAME) #=> false # ditto ;TI"EFile.fnmatch('[/]', '/', File::FNM_PATHNAME) #=> false # ditto ;TI" ;TI"cFile.fnmatch('\?', '?') #=> true # escaped wildcard becomes ordinary ;TI"cFile.fnmatch('\a', 'a') #=> true # escaped ordinary remains ordinary ;TI"aFile.fnmatch('\a', '\a', File::FNM_NOESCAPE) #=> true # FNM_NOESCAPE makes '\' ordinary ;TI"fFile.fnmatch('[\?]', '?') #=> true # can escape inside bracket expression ;TI" ;TI"eFile.fnmatch('*', '.profile') #=> false # wildcard doesn't match leading ;TI"YFile.fnmatch('*', '.profile', File::FNM_DOTMATCH) #=> true # period by default. ;TI"CFile.fnmatch('.*', '.profile') #=> true ;TI" ;TI"CFile.fnmatch('**/*.rb', 'main.rb') #=> false ;TI"CFile.fnmatch('**/*.rb', './main.rb') #=> false ;TI"BFile.fnmatch('**/*.rb', 'lib/song.rb') #=> true ;TI"BFile.fnmatch('**.rb', 'main.rb') #=> true ;TI"CFile.fnmatch('**.rb', './main.rb') #=> false ;TI"BFile.fnmatch('**.rb', 'lib/song.rb') #=> true ;TI"BFile.fnmatch('*', 'dave/.profile') #=> true ;TI" ;TI"JFile.fnmatch('**/foo', 'a/b/c/foo', File::FNM_PATHNAME) #=> true ;TI"JFile.fnmatch('**/foo', '/a/b/c/foo', File::FNM_PATHNAME) #=> true ;TI"JFile.fnmatch('**/foo', 'c:/a/b/c/foo', File::FNM_PATHNAME) #=> true ;TI"KFile.fnmatch('**/foo', 'a/.b/c/foo', File::FNM_PATHNAME) #=> false ;TI"[File.fnmatch('**/foo', 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true;T:@format0: @fileI"dir.rb;T:0@omit_headings_from_table_of_contents_below0I"zFile.fnmatch( pattern, path, [flags] ) -> (true or false) File.fnmatch?( pattern, path, [flags] ) -> (true or false) ;T0[[I" fnmatch?;To;; [ ;@�;0I"(pattern, path, flags = 0);T@�FI" File;TcRDoc::NormalClass00