Class RegExSimple


public class RegExSimple extends RegEx
Matches a Java-style regular expression against the string.

The regular-expression should contain groups, each of which provides an element of the String[] returned for a match.

Author:
Owen Feehan
  • Constructor Details

    • RegExSimple

      public RegExSimple(String matchString)
      Creates with an expression that should match one or more groups.
      Parameters:
      matchString - a Java-style regular-expression.
    • RegExSimple

      public RegExSimple()
    • RegExSimple

      public RegExSimple(String expression, Pattern pattern)
      Creates a new RegExSimple instance.
      Parameters:
      expression - A Java-style regular expression containing groups.
      pattern - Lazy creation of a pattern from the regular-expression string.
  • Method Details

    • match

      public Optional<String[]> match(String string)
      Description copied from class: RegEx
      Returns an array of string components it matches successfully, or Optional.empty() if it cannot match.
      Specified by:
      match in class RegEx
      Parameters:
      string - string to match against the regular-expression.
      Returns:
      an array of string components representing each group in the match, or Optional.empty() if no match is possible.
    • toString

      public String toString()
      Description copied from class: AnchorBean
      By default, we use AnchorBean.describeBean() as the string representation of the bean.
      Overrides:
      toString in class AnchorBean<RegEx>
      Returns:
      the string representation
    • getExpression

      public String getExpression()
      A Java-style regular expression containing groups.
    • setExpression

      public void setExpression(String expression)
      A Java-style regular expression containing groups.