Class RegexTemplateHelper

java.lang.Object
org.mockserver.templates.engine.helpers.RegexTemplateHelper

public class RegexTemplateHelper extends Object
Regular expression helpers for templates: test for a match, replace all matches, and extract a capture group from the first match.
  • Constructor Details

    • RegexTemplateHelper

      public RegexTemplateHelper()
  • Method Details

    • matches

      public boolean matches(String input, String pattern)
      Returns true if the pattern is found anywhere within the input.
    • replaceAll

      public String replaceAll(String input, String pattern, String replacement)
      Replaces every match of the pattern in the input with the replacement.
    • group

      public String group(String input, String pattern, int group)
      Returns the given capture group from the first match of the pattern in the input, or an empty string if there is no match or the group is absent. Group 0 is the entire match.
    • toString

      public String toString()
      Overrides:
      toString in class Object