Class RegexExtractor

All Implemented Interfaces:
Serializable, Cloneable, Searchable, PostProcessor, org.apache.jmeter.testelement.TestElement

public class RegexExtractor extends AbstractScopedTestElement implements PostProcessor, Serializable
See Also:
  • Field Details

  • Constructor Details

    • RegexExtractor

      public RegexExtractor()
  • Method Details

    • getSchema

      public org.apache.jmeter.extractor.RegexExtractorSchema getSchema()
      Specified by:
      getSchema in interface org.apache.jmeter.testelement.TestElement
      Overrides:
      getSchema in class AbstractScopedTestElement
    • getProps

      public org.apache.jmeter.testelement.schema.PropertiesAccessor<? extends RegexExtractor,? extends org.apache.jmeter.extractor.RegexExtractorSchema> getProps()
      Specified by:
      getProps in interface org.apache.jmeter.testelement.TestElement
      Overrides:
      getProps in class AbstractScopedTestElement
    • process

      public void process()
      Parses the response data using regular expressions and saving the results into variables for use later in the test.
      Specified by:
      process in interface PostProcessor
      See Also:
    • setRegex

      public void setRegex(String regex)
      Set the regex to be used
      Parameters:
      regex - The string representation of the regex
    • getRegex

      public String getRegex()
      Get the regex which is to be used
      Returns:
      string representing the regex
    • setRefName

      public void setRefName(String refName)
      Set the prefix name of the variable to be used to store the regex matches
      Parameters:
      refName - prefix of the variables to be used
    • getRefName

      public String getRefName()
      Get the prefix name of the variable to be used to store the regex matches
      Returns:
      The prefix of the variables to be used
    • setMatchNumber

      public void setMatchNumber(int matchNumber)
      Set which Match to use. This can be any positive number, indicating the exact match to use, or 0, which is interpreted as meaning random.
      Parameters:
      matchNumber - The number of the match to be used, or 0 if a random match should be used.
    • setMatchNumber

      public void setMatchNumber(String matchNumber)
    • getMatchNumber

      public int getMatchNumber()
    • getMatchNumberAsString

      public String getMatchNumberAsString()
    • setDefaultValue

      public void setDefaultValue(String defaultValue)
      Sets the value of the variable if no matches are found
      Parameters:
      defaultValue - The default value for the variable
    • setDefaultEmptyValue

      public void setDefaultEmptyValue(boolean defaultEmptyValue)
      Set default value to "" value when if it's empty
      Parameters:
      defaultEmptyValue - The default value for the variable
    • getDefaultValue

      public String getDefaultValue()
      Get the default value for the variable, which should be used, if no matches are found
      Returns:
      The default value for the variable
    • isEmptyDefaultValue

      public boolean isEmptyDefaultValue()
      Do we set default value to "" value when if it's empty
      Returns:
      true if we should set default value to "" if variable cannot be extracted
    • setTemplate

      public void setTemplate(String template)
    • getTemplate

      public String getTemplate()
    • useHeaders

      public boolean useHeaders()
    • useRequestHeaders

      public boolean useRequestHeaders()
    • useBody

      public boolean useBody()
    • useUnescapedBody

      public boolean useUnescapedBody()
    • useBodyAsDocument

      public boolean useBodyAsDocument()
    • useUrl

      public boolean useUrl()
    • useCode

      public boolean useCode()
    • useMessage

      public boolean useMessage()
    • setUseField

      public void setUseField(String actionCommand)