org.apache.jmeter.extractor

## Class RegexExtractor

- java.lang.Object
- - org.apache.jmeter.testelement.AbstractTestElement
  - - org.apache.jmeter.testelement.AbstractScopedTestElement
    - - org.apache.jmeter.extractor.RegexExtractor

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Searchable, PostProcessor, TestElement

      public class RegexExtractor
      extends AbstractScopedTestElement
      implements PostProcessor, java.io.Serializable

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `USE_BODY`
    `static java.lang.String` | `USE_BODY_AS_DOCUMENT`
    `static java.lang.String` | `USE_BODY_UNESCAPED`
    `static java.lang.String` | `USE_CODE`
    `static java.lang.String` | `USE_HDRS`
    `static java.lang.String` | `USE_MESSAGE`
    `static java.lang.String` | `USE_REQUEST_HDRS`
    `static java.lang.String` | `USE_URL`

    - ### Fields inherited from interface org.apache.jmeter.testelement.TestElement

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RegexExtractor()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getDefaultValue()` Get the default value for the variable, which should be used, if no matches are found
    `int` | `getMatchNumber()`
    `java.lang.String` | `getMatchNumberAsString()`
    `java.lang.String` | `getRefName()` Get the prefix name of the variable to be used to store the regex matches
    `java.lang.String` | `getRegex()` Get the regex which is to be used
    `java.lang.String` | `getTemplate()`
    `boolean` | `isEmptyDefaultValue()` Do we set default value to "" value when if it's empty
    `void` | `process()` Parses the response data using regular expressions and saving the results into variables for use later in the test.
    `void` | `setDefaultEmptyValue(boolean defaultEmptyValue)` Set default value to "" value when if it's empty
    `void` | `setDefaultValue(java.lang.String defaultValue)` Sets the value of the variable if no matches are found
    `void` | `setMatchNumber(int matchNumber)` Set which Match to use.
    `void` | `setMatchNumber(java.lang.String matchNumber)`
    `void` | `setRefName(java.lang.String refName)` Set the prefix name of the variable to be used to store the regex matches
    `void` | `setRegex(java.lang.String regex)` Set the regex to be used
    `void` | `setTemplate(java.lang.String template)`
    `void` | `setUseField(java.lang.String actionCommand)`
    `boolean` | `useBody()`
    `boolean` | `useBodyAsDocument()`
    `boolean` | `useCode()`
    `boolean` | `useHeaders()`
    `boolean` | `useMessage()`
    `boolean` | `useRequestHeaders()`
    `boolean` | `useUnescapedBody()`
    `boolean` | `useUrl()`

    - ### Methods inherited from class org.apache.jmeter.testelement.AbstractScopedTestElement

      `fetchScope, getSampleList, getScopeName, getVariableName, isScopeAll, isScopeChildren, isScopeParent, isScopeVariable, isScopeVariable, setScopeAll, setScopeChildren, setScopeParent, setScopeVariable`

    - ### Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

      `addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.jmeter.testelement.TestElement

      `removed`

- - ### Field Detail

    - #### USE_HDRS

          public static final java.lang.String USE_HDRS

      See Also:
        Constant Field Values

    - #### USE_REQUEST_HDRS

          public static final java.lang.String USE_REQUEST_HDRS

      See Also:
        Constant Field Values

    - #### USE_BODY

          public static final java.lang.String USE_BODY

      See Also:
        Constant Field Values

    - #### USE_BODY_UNESCAPED

          public static final java.lang.String USE_BODY_UNESCAPED

      See Also:
        Constant Field Values

    - #### USE_BODY_AS_DOCUMENT

          public static final java.lang.String USE_BODY_AS_DOCUMENT

      See Also:
        Constant Field Values

    - #### USE_URL

          public static final java.lang.String USE_URL

      See Also:
        Constant Field Values

    - #### USE_CODE

          public static final java.lang.String USE_CODE

      See Also:
        Constant Field Values

    - #### USE_MESSAGE

          public static final java.lang.String USE_MESSAGE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### RegexExtractor

          public RegexExtractor()

  - ### Method Detail

    - #### 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:
        `PostProcessor.process()`

    - #### setRegex

          public void setRegex(java.lang.String regex)

      Set the regex to be used
      Parameters:
        `regex` - The string representation of the regex

    - #### getRegex

          public java.lang.String getRegex()

      Get the regex which is to be used
      Returns:
        string representing the regex

    - #### setRefName

          public void setRefName(java.lang.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 java.lang.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(java.lang.String matchNumber)

    - #### getMatchNumber

          public int getMatchNumber()

    - #### getMatchNumberAsString

          public java.lang.String getMatchNumberAsString()

    - #### setDefaultValue

          public void setDefaultValue(java.lang.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 java.lang.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(java.lang.String template)

    - #### getTemplate

          public java.lang.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(java.lang.String actionCommand)

Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.