X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fcom%2Fstevesoft%2Fpat%2FFileRegex.java;h=fa57795cdf887258b1a2dbdfe24d9863c6fc83bf;hb=f4e415106d75a69a373c0c9a37b6bdc2d5a55231;hp=342d41c17c9a1db3fc7da3aaa357193f352c0bc4;hpb=506d60f0e188723ddc91c26824b41ac7034df3fe;p=jalview.git diff --git a/src/com/stevesoft/pat/FileRegex.java b/src/com/stevesoft/pat/FileRegex.java index 342d41c..fa57795 100755 --- a/src/com/stevesoft/pat/FileRegex.java +++ b/src/com/stevesoft/pat/FileRegex.java @@ -7,61 +7,65 @@ // package com.stevesoft.pat; -import java.io.*; -import java.util.*; +import java.io.File; +import java.util.StringTokenizer; +import java.util.Vector; /** * 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:
+ * transformations:
+ *
* - * - * + * + * * - * - * + * + * * - * - * + * + * * - * - * + * + * * - * - * + * + * * - * - * + * + * * - * - * + * + * * - * - * + * + * * - * - * + * + * * - * - * - *
FileRegex Regex FileRegexRegex
* .* *.*
. \. .\.
{ (?: {(?:
{?! (?! {?!(?!
{?= (?= {?=(?=
{?? (?? {??(??
} ) )
? . ?.
{,} (|)
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:
+ * + * + *
{,}(|)
+ *
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 FileRegexRegex
*.java .*\.java$ *.java.*\.java$
*.{java,html} .*\.(java|html)$ *.{java,html}.*\.(java|html)$
foo.[chC] foo.[chC]$
+ * foo.[chC] + * foo.[chC]$ + * + * */ public class FileRegex extends Regex { @@ -82,8 +86,7 @@ public class FileRegex extends Regex * Compile a new pattern. Throws * * @exception com.stevesoft.pat.RegSyntax - * for nonsensical patterns like "[9-0]+" just as Regex - * does. + * for nonsensical patterns like "[9-0]+" just as Regex does. * @see com.stevesoft.pat#compile(java.lang.String) */ public void compile(String s) throws RegSyntax