org.exist.util
Class GlobToRegex

java.lang.Object
  extended byorg.exist.util.GlobToRegex

public class GlobToRegex
extends java.lang.Object

Translates a glob expression into a Java regular expression. The following syntax is supported for glob expressions:

Please remember that the when you construct a Java string in Java code, the backslash character is itself a special Java character, and it must be double backslashed to represent single backslash in a regular expression.

The original code is adapted from the jakarta ORO package.


Constructor Summary
GlobToRegex()
           
 
Method Summary
static java.lang.String globToRegexp(java.lang.CharSequence pattern)
          This static method is the basic engine of the Glob PatternCompiler implementation.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlobToRegex

public GlobToRegex()
Method Detail

globToRegexp

public static java.lang.String globToRegexp(java.lang.CharSequence pattern)
This static method is the basic engine of the Glob PatternCompiler implementation. It takes a glob expression in the form of a character array and converts it into a String representation of a Perl5 pattern. The method is made public so that programmers may use it for their own purposes. However, the GlobCompiler compile methods work by converting the glob pattern to a Perl5 pattern using this method, and then invoking the compile() method of an internally stored Perl5Compiler instance.

Parameters:
pattern - A character array representation of a Glob pattern.
Returns:
A String representation of a Perl5 pattern equivalent to the Glob pattern.

main

public static void main(java.lang.String[] args)
Parameters:
args -


Copyright (C) Wolfgang Meier. All rights reserved.