com.webmethods.caf.common
Class RegularExUtil

java.lang.Object
  extended by com.webmethods.caf.common.RegularExUtil

public class RegularExUtil
extends Object

Base regex utility class containing constant variables for starting and ending regex searches. Gives basic methods for search, match, and replace.


Field Summary
static String RE_BACK_DASH
          Base backslash
static String RE_MATCH_CASEINSENSITIVE
          Make the match case in sensitive
static String RE_MATCH_END
          End of match for regular expression
static String RE_MATCH_START
          Start match for regular expression
static String RE_SUBST_END
          Subset end of regular expression
static String RE_SUBST_START
          Subset start regular expression
 
Constructor Summary
RegularExUtil()
           
 
Method Summary
static String getMatchRE(String value)
          Prepare RE for Perl5Util.match() call.
static String getMatchRE(String value, boolean caseSensitive)
          Prepare RE for Perl5Util.match() call
static String getReplacementRE(String oldValue, String newValue)
          Prepare RE for Perl5Util.substitute() call in the form
static boolean match(String regularExpression, String inputText)
          Returns true if the input text matches the regular expression with case insensitive
static boolean match(String regularExpression, String inputText, boolean caseInsensitve)
          Returns true if the input text matches the regular expression with either case sensitive or case insensitive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RE_BACK_DASH

public static final String RE_BACK_DASH
Base backslash

See Also:
Constant Field Values

RE_SUBST_START

public static final String RE_SUBST_START
Subset start regular expression

See Also:
Constant Field Values

RE_SUBST_END

public static final String RE_SUBST_END
Subset end of regular expression

See Also:
Constant Field Values

RE_MATCH_START

public static final String RE_MATCH_START
Start match for regular expression

See Also:
Constant Field Values

RE_MATCH_END

public static final String RE_MATCH_END
End of match for regular expression

See Also:
Constant Field Values

RE_MATCH_CASEINSENSITIVE

public static final String RE_MATCH_CASEINSENSITIVE
Make the match case in sensitive

See Also:
Constant Field Values
Constructor Detail

RegularExUtil

public RegularExUtil()
Method Detail

match

public static boolean match(String regularExpression,
                            String inputText)
Returns true if the input text matches the regular expression with case insensitive

Parameters:
regularExpression - regular expression that input must match
inputText - value to compare
Returns:
if inputText matches regularExpression

match

public static boolean match(String regularExpression,
                            String inputText,
                            boolean caseInsensitve)
Returns true if the input text matches the regular expression with either case sensitive or case insensitive

Parameters:
regularExpression - regular expression that input must match
inputText - value to compare
caseInsensitve - true if we care about case sensitive
Returns:
if inputText matches regularExpression

getReplacementRE

public static String getReplacementRE(String oldValue,
                                      String newValue)
Prepare RE for Perl5Util.substitute() call in the form

Parameters:
oldValue - s/oldValue/newValue/g - case-sensitive variant
newValue - s/oldValue/newValue/gi - case-insensitive variant
Returns:
the regular expression

getMatchRE

public static String getMatchRE(String value)
Prepare RE for Perl5Util.match() call. Note: this constructs a regex that is case sensitive. If you need a case-insensitive regex use the getMatchRE method with two parameters.

Parameters:
value - the inner value of the regex
Returns:
regular expression for doing a match style regex operation

getMatchRE

public static String getMatchRE(String value,
                                boolean caseSensitive)
Prepare RE for Perl5Util.match() call

Parameters:
value - the inner value of the regex
caseSensitive - true if the match should be case sensitive, false otherwise
Returns:
regular expression for doing a match style regex operation