Next: , Previous: , Up: Internal Routines   [Contents][Index]


15.5.283 getmatchedfiles

getmatchedfiles(regexp, directory [, maxfiles])

[regex_h] Returns, in a string array, a list of names of files from the directory that match the pattern regexp. At most maxfiles files are returned, which defaults to 100. If no files are found, then scalar 0 is returned.

The pattern is a regular expression. Matches to parts of the file names are accepted. Regular expressions consist of ordinary characters (which must be matched as is) and special characters. Some of the special characters and their meanings are:

.

Matches any single character.

[...]

Matches any single character from the set listed between the square brackets.

[^...]

Matches any single character except those from the set listed between the square brackets.

*

Matches zero or more successive occurrences of the preceding regular expression.

^

Matches the beginning of the line (if it is the first character in the pattern).

$

Matches the end of the line (if it is the last character in the pattern).

\{m,n\}

Matches between m and n successive occurrences of the preceding regular expression; \{m\} matches exactly m occurrences, and \{m,\} matches at least m occurrences.

\

Removes the special status from the following character; i.e., \* stands for an asterisk.

This routine is only available if your computer platform supports it.

See also: getfiles, getmatchedfiles_r