glob
Search file systems with glob
patterns using the D programming language
Discussion
See Glob https://en.wikipedia.org/wiki/Glob_(programming)
Home page:
https://github.com/workhorsy/d-glob
Version
0.5.0
License
Boost Software License - Version 1.0
-
Declaration
string[]
glob
(stringpath_name
);Return all the paths that match the
glob
patternParameters
string
path_name
The path with paterns to match.
Examples
import glob : glob; // Use * to match zero or more instances of a character string[] entries = glob("/usr/bin/python*"); /* entries would contain: /usr/bin/python2 /usr/bin/python2.7 /usr/bin/python3 /usr/bin/python3.5 */ // Use ? to match one instance of a character entries = glob("/usr/bin/python2.?"); /* entries would contain: /usr/bin/python2.6 /usr/bin/python2.7 */ // Use [] to match one instance of a character between the brackets entries = glob("/usr/bin/python[23]"); /* entries would contain: /usr/bin/python2 /usr/bin/python3 */ // Use [!] to match one instance of a character NOT between the brackets entries = glob("/usr/bin/python[!3]"); /* entries would contain: /usr/bin/python2 */ // Use {} to match any of the full strings entries = glob("/usr/bin/{python,ruby}"); /* entries would contain: /usr/bin/python /usr/bin/ruby */
-
Declaration
string[]
globRegex
(stringpath_regex
);Return all the paths that match the regex pattern
Parameters
string
path_regex
The path with regex paterns to match.
Examples
import glob : globRegex; // Use a regex to match all the number files in /proc/ string[] entries = globRegex(`^/proc/[0-9]*$`); /* entries would contain: /proc/111 /proc/245 /proc/19533 /proc/1 */