net.craftforge.essential.controller.utils
Class RegExUtils

java.lang.Object
  extended by net.craftforge.essential.controller.utils.RegExUtils

public class RegExUtils
extends Object

Utilities for regular expression actions.

Since:
17.02.2011
Author:
Christian Bick

Field Summary
static String DEFAULT_REG_EX
          The regular expression used for default resource path variables
static Pattern FIND_ALL_LITERALS
          Finds all literals and numbers
static Pattern FIND_ALL_NONE_LITERALS
          Finds all none literals and numbers
static Pattern FIND_CHARSET
          Finds all charset=XYZ notations regardless of whitespace characters and provides a group for XYZ
static Pattern FIND_COLON
          Finds colons
static Pattern FIND_CURLY_BRACKETS
          Finds all opening and closing curly brackets
static Pattern FIND_ENCLOSED_BY_CURLY_BRACKETS
          Finds all characters enclosed by curly brackets including the brackets
static Pattern FIND_HEADER
          Finds all characters enclosed by square brackets starting with 'header:' and provides a group for the characters after header
static Pattern FIND_NO_EQUAL_CONTAINED
          Finds a character sequence that does not contain an equal character.
static Pattern FIND_REG_EX_OPERATORS
          Finds regular expression characters
static Pattern FIND_SEMI_COLON
          Finds semi colons
static Pattern FIND_SLASH
          Finds slashes
 
Constructor Summary
RegExUtils()
           
 
Method Summary
static String getParamNameFromPathPart(String pathPart)
          Gets the param name from a (virtual) path part assuming it to not be static.
static String getParamNameFromPathPart(String pathPart, boolean withCurlyBrackets)
          Gets the param name from a (virtual) path part assuming it to not be static.
static String getRegExFromPathPart(String pathPart)
          Gets the regular expression encoded in a (virtual) path part.
static String[] getValuesFromPathPart(String pathPart)
          Gets the values from a (real) path part assuming the part to be variable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_REG_EX

public static final String DEFAULT_REG_EX
The regular expression used for default resource path variables

See Also:
Constant Field Values

FIND_REG_EX_OPERATORS

public static final Pattern FIND_REG_EX_OPERATORS
Finds regular expression characters


FIND_SLASH

public static final Pattern FIND_SLASH
Finds slashes


FIND_SEMI_COLON

public static final Pattern FIND_SEMI_COLON
Finds semi colons


FIND_COLON

public static final Pattern FIND_COLON
Finds colons


FIND_ALL_LITERALS

public static final Pattern FIND_ALL_LITERALS
Finds all literals and numbers


FIND_ALL_NONE_LITERALS

public static final Pattern FIND_ALL_NONE_LITERALS
Finds all none literals and numbers


FIND_CURLY_BRACKETS

public static final Pattern FIND_CURLY_BRACKETS
Finds all opening and closing curly brackets


FIND_ENCLOSED_BY_CURLY_BRACKETS

public static final Pattern FIND_ENCLOSED_BY_CURLY_BRACKETS
Finds all characters enclosed by curly brackets including the brackets


FIND_HEADER

public static final Pattern FIND_HEADER
Finds all characters enclosed by square brackets starting with 'header:' and provides a group for the characters after header


FIND_CHARSET

public static final Pattern FIND_CHARSET
Finds all charset=XYZ notations regardless of whitespace characters and provides a group for XYZ


FIND_NO_EQUAL_CONTAINED

public static final Pattern FIND_NO_EQUAL_CONTAINED
Finds a character sequence that does not contain an equal character.

Constructor Detail

RegExUtils

public RegExUtils()
Method Detail

getRegExFromPathPart

public static String getRegExFromPathPart(String pathPart)

Gets the regular expression encoded in a (virtual) path part.

The following cases are handled by this method:

Parameters:
pathPart - The path part
Returns:
The regular expression

getValuesFromPathPart

public static String[] getValuesFromPathPart(String pathPart)

Gets the values from a (real) path part assuming the part to be variable. Multiple values are expected to be semi-colon separated.

Examples:

Parameters:
pathPart - The path part
Returns:
The values from the part

getParamNameFromPathPart

public static String getParamNameFromPathPart(String pathPart,
                                              boolean withCurlyBrackets)

Gets the param name from a (virtual) path part assuming it to not be static. Depending on the flag, the parameter name is returned in curly brackets or without.

Parameters:
pathPart - The path part
withCurlyBrackets - Whether the result has curly brackets or not
Returns:
The param name

getParamNameFromPathPart

public static String getParamNameFromPathPart(String pathPart)
Gets the param name from a (virtual) path part assuming it to not be static.

Parameters:
pathPart - The path part
Returns:
The param name (with curly brackets)


Copyright © 2011. All Rights Reserved.