297 /** 298 * Returns a {@code PathMatcher} that performs match operations on the 299 * {@code String} representation of {@link Path} objects by interpreting a 300 * given pattern. 301 * 302 * The {@code syntaxAndPattern} parameter identifies the syntax and the 303 * pattern and takes the form: 304 * <blockquote><pre> 305 * <i>syntax</i><b>:</b><i>pattern</i> 306 * </pre></blockquote> 307 * where {@code ':'} stands for itself. 308 * 309 * <p> A {@code FileSystem} implementation supports the "{@code glob}" and 310 * "{@code regex}" syntaxes, and may support others. The value of the syntax 311 * component is compared without regard to case. 312 * 313 * <p> When the syntax is "{@code glob}" then the {@code String} 314 * representation of the path is matched using a limited pattern language 315 * that resembles regular expressions but with a simpler syntax. For example: 316 * 317 * <blockquote> 318 * <table class="borderless"> 319 * <caption style="display:none">Pattern Language</caption> 320 * <tbody> 321 * <tr> 322 * <td>{@code *.java}</td> 323 * <td>Matches a path that represents a file name ending in {@code .java}</td> 324 * </tr> 325 * <tr> 326 * <td>{@code *.*}</td> 327 * <td>Matches file names containing a dot</td> 328 * </tr> 329 * <tr> 330 * <td>{@code *.{java,class}}</td> 331 * <td>Matches file names ending with {@code .java} or {@code .class}</td> 332 * </tr> 333 * <tr> 334 * <td>{@code foo.?}</td> 335 * <td>Matches file names starting with {@code foo.} and a single 336 * character extension</td> 337 * </tr> 338 * <tr> 339 * <td><code>/home/*/*</code> 340 * <td>Matches <code>/home/gus/data</code> on UNIX platforms</td> 341 * </tr> 342 * <tr> 343 * <td><code>/home/**</code> 344 * <td>Matches <code>/home/gus</code> and 345 * <code>/home/gus/data</code> on UNIX platforms</td> 346 * </tr> 347 * <tr> 348 * <td><code>C:\\*</code> 349 * <td>Matches <code>C:\foo</code> and <code>C:\bar</code> on the Windows 350 * platform (note that the backslash is escaped; as a string literal in the 351 * Java Language the pattern would be <code>"C:\\\\*"</code>) </td> 352 * </tr> 353 * </tbody> 354 * </table> 355 * </blockquote> 356 * 357 * <p> The following rules are used to interpret glob patterns: 358 * 359 * <ul> 360 * <li><p> The {@code *} character matches zero or more {@link Character 361 * characters} of a {@link Path#getName(int) name} component without 362 * crossing directory boundaries. </p></li> 363 * 364 * <li><p> The {@code **} characters matches zero or more {@link Character 365 * characters} crossing directory boundaries. </p></li> 366 * 367 * <li><p> The {@code ?} character matches exactly one character of a 368 * name component.</p></li> 369 * 370 * <li><p> The backslash character ({@code \}) is used to escape characters 371 * that would otherwise be interpreted as special characters. The expression 372 * {@code \\} matches a single backslash and "\{" matches a left brace 373 * for example. </p></li> 374 * 375 * <li><p> The {@code [ ]} characters are a <i>bracket expression</i> that | 297 /** 298 * Returns a {@code PathMatcher} that performs match operations on the 299 * {@code String} representation of {@link Path} objects by interpreting a 300 * given pattern. 301 * 302 * The {@code syntaxAndPattern} parameter identifies the syntax and the 303 * pattern and takes the form: 304 * <blockquote><pre> 305 * <i>syntax</i><b>:</b><i>pattern</i> 306 * </pre></blockquote> 307 * where {@code ':'} stands for itself. 308 * 309 * <p> A {@code FileSystem} implementation supports the "{@code glob}" and 310 * "{@code regex}" syntaxes, and may support others. The value of the syntax 311 * component is compared without regard to case. 312 * 313 * <p> When the syntax is "{@code glob}" then the {@code String} 314 * representation of the path is matched using a limited pattern language 315 * that resembles regular expressions but with a simpler syntax. For example: 316 * 317 * <table class="striped" style="text-align:left; margin-left:2em"> 318 * <caption style="display:none">Pattern Language</caption> 319 * <thead> 320 * <tr> 321 * <th scope="col">Example 322 * <th scope="col">Description 323 * </tr> 324 * </thead> 325 * <tbody> 326 * <tr> 327 * <th scope="row">{@code *.java}</th> 328 * <td>Matches a path that represents a file name ending in {@code .java}</td> 329 * </tr> 330 * <tr> 331 * <th scope="row">{@code *.*}</th> 332 * <td>Matches file names containing a dot</td> 333 * </tr> 334 * <tr> 335 * <th scope="row">{@code *.{java,class}}</th> 336 * <td>Matches file names ending with {@code .java} or {@code .class}</td> 337 * </tr> 338 * <tr> 339 * <th scope="row">{@code foo.?}</th> 340 * <td>Matches file names starting with {@code foo.} and a single 341 * character extension</td> 342 * </tr> 343 * <tr> 344 * <th scope="row"><code>/home/*/*</code> 345 * <td>Matches <code>/home/gus/data</code> on UNIX platforms</td> 346 * </tr> 347 * <tr> 348 * <th scope="row"><code>/home/**</code> 349 * <td>Matches <code>/home/gus</code> and 350 * <code>/home/gus/data</code> on UNIX platforms</td> 351 * </tr> 352 * <tr> 353 * <th scope="row"><code>C:\\*</code> 354 * <td>Matches <code>C:\foo</code> and <code>C:\bar</code> on the Windows 355 * platform (note that the backslash is escaped; as a string literal in the 356 * Java Language the pattern would be <code>"C:\\\\*"</code>) </td> 357 * </tr> 358 * </tbody> 359 * </table> 360 * 361 * <p> The following rules are used to interpret glob patterns: 362 * 363 * <ul> 364 * <li><p> The {@code *} character matches zero or more {@link Character 365 * characters} of a {@link Path#getName(int) name} component without 366 * crossing directory boundaries. </p></li> 367 * 368 * <li><p> The {@code **} characters matches zero or more {@link Character 369 * characters} crossing directory boundaries. </p></li> 370 * 371 * <li><p> The {@code ?} character matches exactly one character of a 372 * name component.</p></li> 373 * 374 * <li><p> The backslash character ({@code \}) is used to escape characters 375 * that would otherwise be interpreted as special characters. The expression 376 * {@code \\} matches a single backslash and "\{" matches a left brace 377 * for example. </p></li> 378 * 379 * <li><p> The {@code [ ]} characters are a <i>bracket expression</i> that |