1 21 package proguard.util; 22 23 import proguard.classfile.ClassConstants; 24 25 import java.io.*; 26 27 38 public class FileNameMatcher extends BasicMatcher 39 { 40 private static final char[] FILE_NAME_CHARACTERS = new char[] 41 { 42 ' ', 43 '-', 44 '+', 45 '.' 46 }; 47 48 private static final char[] EXTENDED_FILE_NAME_CHARACTERS = new char[] 49 { 50 ClassConstants.INTERNAL_PACKAGE_SEPARATOR, 51 File.separatorChar 52 }; 53 54 55 60 public FileNameMatcher(String regularExpression) 61 { 62 super(regularExpression, 63 FILE_NAME_CHARACTERS, 64 EXTENDED_FILE_NAME_CHARACTERS, 65 null); 66 } 67 68 69 72 public static void main(String [] args) 73 { 74 try 75 { 76 System.out.println("Regular expression ["+args[0]+"]"); 77 FileNameMatcher matcher = new FileNameMatcher(args[0]); 78 for (int index = 1; index < args.length; index++) 79 { 80 String string = args[index]; 81 System.out.print("String ["+string+"]"); 82 System.out.println(" -> match = "+matcher.matches(args[index])); 83 } 84 } 85 catch (Exception ex) 86 { 87 ex.printStackTrace(); 88 } 89 } 90 } 91 | Popular Tags |