classpathhelper
Class RegExUtil

java.lang.Object
  extended byclasspathhelper.RegExUtil

public class RegExUtil
extends java.lang.Object

Utility class that helps create Java (Perl) regular expressions from standard path based regular expressions.

Example

The following standard path based regular expressions are interpreted as follows:
com/foo/bar/*.properties - All properties files in com/foo/bar
**/*.properties - All properties files on any path.

The following standard classname based regular expressions are interpreted as follows:
javax.xml.* - All the classes in the javax.xml package.
com.sun.** - All class names under com.sun and com.sun subpackages.

Usage


 // simply supply your path based regular expression
 Pattern p = RegExUtil.createPathPattern("META-INF/**");
 

 // simply supply your package based regular expression
 Pattern p = RegExUtil.createClassPattern("javax.xml.*");
 

Since:
1.1
Author:
bharris

Constructor Summary
RegExUtil()
           
 
Method Summary
static java.util.regex.Pattern createClassPattern(java.lang.String path)
          Creates a standard regular expression based on a class name style regular expression.
static java.util.regex.Pattern createPathPattern(java.lang.String path)
          Creates a standard regular expression based on a path style regular expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegExUtil

public RegExUtil()
Method Detail

createPathPattern

public static java.util.regex.Pattern createPathPattern(java.lang.String path)
Creates a standard regular expression based on a path style regular expression.

Parameters:
path - The path style regular expression.
Returns:
A standard Pattern that can be used to match paths against.
Since:
1.1

createClassPattern

public static java.util.regex.Pattern createClassPattern(java.lang.String path)
Creates a standard regular expression based on a class name style regular expression.

Parameters:
path - A classname style regular expression.
Returns:
A standard Pattern that can be used to match class names against.
Since:
1.1