Package com.webmethods.caf.common
Class RegularExUtil
java.lang.Object
com.webmethods.caf.common.RegularExUtil
Base regex utility class containing constant variables for starting and ending regex searches.
Gives basic methods for search, match, and replace.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Base backslashstatic final String
Make the match case in sensitivestatic final String
End of match for regular expressionstatic final String
Start match for regular expressionstatic final String
Subset end of regular expressionstatic final String
Subset start regular expression -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getMatchRE
(String value) Prepare RE for Perl5Util.match() call.static String
getMatchRE
(String value, boolean caseSensitive) Prepare RE for Perl5Util.match() callstatic String
getReplacementRE
(String oldValue, String newValue) Prepare RE for Perl5Util.substitute() call in the formstatic boolean
Returns true if the input text matches the regular expression with case insensitivestatic boolean
Returns true if the input text matches the regular expression with either case sensitive or case insensitive
-
Field Details
-
RE_BACK_DASH
Base backslash- See Also:
-
RE_SUBST_START
Subset start regular expression- See Also:
-
RE_SUBST_END
Subset end of regular expression- See Also:
-
RE_MATCH_START
Start match for regular expression- See Also:
-
RE_MATCH_END
End of match for regular expression- See Also:
-
RE_MATCH_CASEINSENSITIVE
Make the match case in sensitive- See Also:
-
-
Constructor Details
-
RegularExUtil
public RegularExUtil()
-
-
Method Details
-
match
Returns true if the input text matches the regular expression with case insensitive- Parameters:
regularExpression
- regular expression that input must matchinputText
- value to compare- Returns:
- if inputText matches regularExpression
-
match
Returns true if the input text matches the regular expression with either case sensitive or case insensitive- Parameters:
regularExpression
- regular expression that input must matchinputText
- value to comparecaseInsensitve
- true if we care about case sensitive- Returns:
- if inputText matches regularExpression
-
getReplacementRE
Prepare RE for Perl5Util.substitute() call in the form- Parameters:
oldValue
-s/oldValue/newValue/g
- case-sensitive variantnewValue
-s/oldValue/newValue/gi
- case-insensitive variant- Returns:
- the regular expression
-
getMatchRE
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
Prepare RE for Perl5Util.match() call- Parameters:
value
- the inner value of the regexcaseSensitive
- true if the match should be case sensitive, false otherwise- Returns:
- regular expression for doing a match style regex operation
-