Class RegEx

Object
org.anchoranalysis.bean.AnchorBean<RegEx>
org.anchoranalysis.bean.shared.regex.RegEx
Direct Known Subclasses:
RegExList, RegExSimple

public abstract class RegEx
extends AnchorBean<RegEx>
The regular-expression to use for matching groups.

It should always define at least one group (i.e. using parentheses).

Author:
Owen Feehan
  • Constructor Details

  • Method Details

    • match

      public abstract Optional<String[]> match​(String string)
      Returns an array of string components it matches successfully, or Optional.empty() if it cannot match.
      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.
    • hasMatch

      public boolean hasMatch​(String string)
      Returns a boolean whether the regular-expression successfully matches a string or not.
      Parameters:
      string - string to match against the regular-expression.
      Returns:
      true if successfully matched, false otherwise.