public abstract PathMatcher getPathMatcher (String syntaxAndPattern)

Returns a PathMatcher that performs match operations on the String representation of Path objects by interpreting a given pattern. The syntaxAndPattern parameter identifies the syntax and the pattern and takes the form:

where ':' stands for itself.

A FileSystem implementation supports the " glob" and " regex" syntaxes, and may support others. The value of the syntax component is compared without regard to case.

When the syntax is " glob" then the String representation of the path is matched using a limited pattern language that resembles regular expressions but with a simpler syntax. For example:

*.java Matches a path that represents a file name ending in .java
*.* Matches file names containing a dot
*.{java,class} Matches file names ending with .java or .class
foo.? Matches file names starting with foo. and a single character extension
/home/*/* Matches /home/gus/data on UNIX platforms
/home/** Matches /home/gus and /home/gus/data on UNIX platforms
C:\\* Matches C:\foo and C:\bar on the Windows platform (note that the backslash is escaped; as a string literal in the Java Language the pattern would be "C:\\\\*")

The following rules are used to interpret glob patterns:

When the syntax is " regex" then the pattern component is a regular expression as defined by the java.util.regex.Pattern class.

For both the glob and regex syntaxes, the matching details, such as whether the matching is case sensitive, are implementation-dependent and therefore not specified.

syntaxAndPattern     The syntax and pattern

Returns:  A path matcher that may be used to match paths against the pattern

IllegalArgumentException     If the parameter does not take the form: syntax:pattern
java.util.regex.PatternSyntaxException     If the pattern is invalid
UnsupportedOperationException     If the pattern syntax is not known to the implementation

See also: