Class RegularExUtil

java.lang.Object
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 Details

  • Constructor Details

    • RegularExUtil

      public RegularExUtil()
  • Method Details

    • 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