This class is a different form of Regex designed to work more
like the file matching utility of a Unix shell. It is implemented
by some simple string transformations:
FileRegex
Regex
*
.*
.
\.
{
(?:
{?!
(?!
{?=
(?=
{??
(??
}
)
?
.
{,}
(|)
Note that a FileRegex pattern always ends with the Regex
pattern element "$". If you like to experiment, try making
FileRegex's and then printing them out. The toString() method
does a decompile of the pattern to a standard Regex. Here are
some more complete examples:
FileRegex
Regex
*.java
.*\.java$
*.{java,html}
.*\.(java|html)$
foo.[chC]
foo.[chC]$
Fields inherited from class COM.stevesoft.pat.Regex
public static java.lang.String[] list(java.lang.String f)
Provides an alternative to File.list -- this
separates its argument according to File.pathSeparator.
To each path, it splits off a directory -- all characters
up to and including the first instance of File.separator --
and a file pattern -- the part that comes after the directory.
It then produces a list of all the pattern matches on all
the paths. Thus "*.java:../*.java" would produce a list of
all the java files in this directory and in the ".." directory
on a Unix machine. "*.java;..\\*.java" would do the same thing
on a Dos machine.
toFileRegex
public static java.lang.String toFileRegex(java.lang.String s)
This method takes a file regular expression, and translates it
into the type of pattern used by a normal Regex.