Class RgxMatch

java.lang.Object
dev.comfast.rgx.RgxMatch

public class RgxMatch extends Object
Represent one Regex match. Can be empty.
  • Field Details

  • Constructor Details

  • Method Details

    • get

      public String get()
      Returns:
      entire match.
    • group

      public String group(int nth)
      Returns:
      nth match group.
    • isPresent

      public boolean isPresent()
      Returns:
      true if match found
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if match empty
    • orElse

      public String orElse(String elseValue)
      Returns:
      entire match or else default value
    • throwIfEmpty

      public RgxMatch throwIfEmpty()
      Throws Exception with match details if match empty.
    • throwIfEmpty

      public RgxMatch throwIfEmpty(String failMsg, Object... msgArgs)
      Parameters:
      failMsg - will throw only cause Exception
      msgArgs - printf arguments for failMsg
      Returns:
      this