com.linkwerk.util
Class Regexp

java.lang.Object
  extended by com.linkwerk.util.Regexp

public abstract class Regexp
extends java.lang.Object

Regexp Regular Expressions covers extension functions that provide facilities to do with regular expressions to XSLT.

This package implements the regular expression extension following the rules given by exslt.org.

The regular expressions used in this module use the regular expression syntax of the java.util.regex package of the Java 2 Platform, Standard Edition (since 1.4), and are not following the Javascript regular expression syntax.

Version:
1.0
Author:
Christoph Leisegang
See Also:
java.util.regex package of the Java 2 Platform, Standard Edition (since 1.4)

Constructor Summary
Regexp()
           
 
Method Summary
static org.w3c.dom.NodeList match(org.w3c.dom.NodeList nl, java.lang.String pattern)
          The match function returns a node set of match elements, for each string value that is equal to a portion of the first parameter node list, captured by the second parameter regular expression All the text nodes or attributes of the elements or attribute values of the node list are concatenated before the match is executed.
static org.w3c.dom.NodeList match(org.w3c.dom.NodeList nl, java.lang.String pattern, java.lang.String flags)
          The match function returns a node set of match elements, for each string value that is equal to a portion of the first parameter node list, captured by the second parameter regular expression.
static org.w3c.dom.NodeList match(java.lang.String input, java.lang.String pattern)
          The match function returns a node set of match elements, for each string value that is equal to a portion of the first parameter string, captured by the second parameter regular expression.
static org.w3c.dom.NodeList match(java.lang.String input, java.lang.String pattern, java.lang.String flags)
          The match function returns a node set of match elements, for each string value that is equal to a portion of the first parameter string, captured by the second parameter regular expression The second parameter is a regular expression that follows the regular expression syntax of the java.util.regex package of the Java 2 Platform, Standard Edition (since 1.4).
static java.lang.String replace(org.w3c.dom.NodeList nl, java.lang.String pattern, java.lang.String flags, java.lang.String replace)
          The replace function returns a string with parts of the string given as the first parameter that match second parameter regular expression replaced with another string.
static java.lang.String replace(java.lang.String input, java.lang.String pattern, java.lang.String flags, java.lang.String replace)
          The replace function returns a string with parts of the string given as the first parameter that match second parameter regular expression replaced with another string.
static boolean test(org.w3c.dom.NodeList nl, java.lang.String pattern)
          The test function returns true if the node list given as the first parameter matches the regular expression given as the second parameter.
static boolean test(org.w3c.dom.NodeList nl, java.lang.String pattern, java.lang.String flags)
          The test function returns true if the node list given as the first parameter matches the regular expression given as the second parameter.
static boolean test(java.lang.String input, java.lang.String pattern)
          The test function returns true if the string given as the first parameter matches the regular expression given as the second parameter.
static boolean test(java.lang.String input, java.lang.String pattern, java.lang.String flags)
          The test function returns true if the string given as the first parameter matches the regular expression given as the second parameter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Regexp

public Regexp()
Method Detail

test

public static boolean test(org.w3c.dom.NodeList nl,
                           java.lang.String pattern)
The test function returns true if the node list given as the first parameter matches the regular expression given as the second parameter.

The input sequence is scanned looking for the first subsequence that matches the pattern.

All the text nodes or attribute values of the node list are concatenated before the test is executed.

Parameters:
nl - the node list to be tested
pattern - the regular expression
Returns:
true, if the node list matches the regular expression
See Also:
test(java.lang.String input, java.lang.String pattern, java.lang.String flags)

test

public static boolean test(org.w3c.dom.NodeList nl,
                           java.lang.String pattern,
                           java.lang.String flags)
The test function returns true if the node list given as the first parameter matches the regular expression given as the second parameter.

The input sequence is scanned looking for the first subsequence that matches the pattern.

All the text nodes or attribute values of the node list are concatenated before the test is executed.

Parameters:
nl - the node list to be tested
pattern - the regular expression
flags - the flags to be used ("g","i")
Returns:
true, if the node list matches the regular expression
See Also:
test(java.lang.String input, java.lang.String pattern, java.lang.String flags)

test

public static boolean test(java.lang.String input,
                           java.lang.String pattern)
The test function returns true if the string given as the first parameter matches the regular expression given as the second parameter.

The input sequence is scanned looking for the first subsequence that matches the pattern.

The second parameter is a regular expression that follows the regular expression syntax of the java.util.regex package of the Java 2 Platform, Standard Edition (since 1.4).

Parameters:
input - the string to be tested
pattern - the regular expression
Returns:
true, if the node list matches the regular expression
See Also:
test(java.lang.String input, java.lang.String pattern, java.lang.String flags)

test

public static boolean test(java.lang.String input,
                           java.lang.String pattern,
                           java.lang.String flags)
The test function returns true if the string given as the first parameter matches the regular expression given as the second parameter.

The input sequence is scanned looking for the first subsequence that matches the pattern.

The second parameter is a regular expression that follows the regular expression syntax of the java.util.regex package of the Java 2 Platform, Standard Edition (since 1.4).

The third parameter is a string consisting of flags to be used by test. If a character is present than the flag is true. Possible flags are:

g: global test - has no effect on this function and is just retained for consistency with Regexp.match and Regexp.replace. i: case insenitive - the regular expression is treated as case insensitiv. The default uses case senitive regular expressions.

Parameters:
input - the string to be tested
pattern - the regular expression
flags - the flags to be used ("g","i")
Returns:
true, if the node list matches the regular expression

match

public static org.w3c.dom.NodeList match(org.w3c.dom.NodeList nl,
                                         java.lang.String pattern)
The match function returns a node set of match elements, for each string value that is equal to a portion of the first parameter node list, captured by the second parameter regular expression All the text nodes or attributes of the elements or attribute values of the node list are concatenated before the match is executed.

Parameters:
nl - the node list to be matched
pattern - the regular expression
Returns:
node set of match elements
See Also:
match(java.lang.String input, java.lang.String pattern, java.lang.String flags)

match

public static org.w3c.dom.NodeList match(org.w3c.dom.NodeList nl,
                                         java.lang.String pattern,
                                         java.lang.String flags)
The match function returns a node set of match elements, for each string value that is equal to a portion of the first parameter node list, captured by the second parameter regular expression. All the text nodes or attribute values of the node list are concatenated before match is executed.

Parameters:
nl - the node list to be matched
pattern - the regular expression
flags - the flags to be used ("g","i")
Returns:
node set of match elements
See Also:
match(java.lang.String input, java.lang.String pattern, java.lang.String flags)

match

public static org.w3c.dom.NodeList match(java.lang.String input,
                                         java.lang.String pattern)
The match function returns a node set of match elements, for each string value that is equal to a portion of the first parameter string, captured by the second parameter regular expression.

Parameters:
input - the string to be matched
pattern - the regular expression
Returns:
node set of match elements
See Also:
match(java.lang.String input, java.lang.String pattern, java.lang.String flags)

match

public static org.w3c.dom.NodeList match(java.lang.String input,
                                         java.lang.String pattern,
                                         java.lang.String flags)
The match function returns a node set of match elements, for each string value that is equal to a portion of the first parameter string, captured by the second parameter regular expression

The second parameter is a regular expression that follows the regular expression syntax of the java.util.regex package of the Java 2 Platform, Standard Edition (since 1.4).

The third parameter is a string consisting of flags to be used by match. If a character is present than the flag is true. Possible flags are:

g: global match - the submatches of all the matches in the string are returned. The default (character is not present) returns only the submatches of the first match in the string. i: case insenitive - the regular expression is treated as case insensitiv. The default uses case senitive regular expressions.

Parameters:
input - the string to be matched
pattern - the regular expression
flags - the flags to be used ("g","i")
Returns:
node set of match elements

replace

public static java.lang.String replace(org.w3c.dom.NodeList nl,
                                       java.lang.String pattern,
                                       java.lang.String flags,
                                       java.lang.String replace)
The replace function returns a string with parts of the string given as the first parameter that match second parameter regular expression replaced with another string.

Parameters:
nl - the node list to be matched and replaced
pattern - the regular expression
flags - the flags to be used ("g","i")
replace - the replacing string
Returns:
the replaced string
See Also:
replace(java.lang.String input, java.lang.String pattern, java.lang.String flags java.lang.String repStr)

replace

public static java.lang.String replace(java.lang.String input,
                                       java.lang.String pattern,
                                       java.lang.String flags,
                                       java.lang.String replace)
The replace function returns a string with parts of the string given as the first parameter that match second parameter regular expression replaced with another string.

The second parameter is a regular expression that follows the regular expression syntax of the java.util.regex package of the Java 2 Platform, Standard Edition (since 1.4).

The third parameter is a string consisting of flags to be used by replace. If a character is present than the flag is true. Possible flags are:

g: global match - the submatches of all the matches in the string are returned. The default (character is not present) returns only the submatches of the first match in the string. i: case insenitive - the regular expression is treated as case insensitiv. The default uses case senitive regular expressions.

The fourth parameter is the string to replace the matched parts.

Parameters:
input - the string to be matched and replaced
pattern - the regular expression
flags - the flags to be used ("g","i")
replace - the replacing string
Returns:
the replaced string