---
title: EntityExtractFilter
description: Extracts regular expression patterns from a message entity, and stores their values in a target object. Use this object in password replay, to find a login path or extract a nonce.
component: pinggateway
version: 2026
page_id: pinggateway:reference:EntityExtractFilter
canonical_url: https://docs.pingidentity.com/pinggateway/2026/reference/EntityExtractFilter.html
revdate: 2025-02-13T12:29:30Z
section_ids:
  EntityExtractFilter-usage: Usage
  EntityExtractFilter-properties: Properties
  EntityExtractFilter-examples: Examples
---

# EntityExtractFilter

Extracts regular expression patterns from a message entity, and stores their values in a `target` object. Use this object in password replay, to find a login path or extract a nonce.

If the message `type` is `REQUEST`, the pattern is extracted before the request is handled. If the message `type` is `RESPONSE`, the pattern is extracted out of the response body.

Each pattern can have an associated template, which is applied to its match result.

For information, see [Patterns and PingGateway](Patterns.html).

## Usage

```json
{
    "name": string,
    "type": "EntityExtractFilter",
    "config": {
        "messageType": configuration expression<enumeration>,
        "charset": configuration expression<string>,
        "target": lvalue-expression,
        "bindings": [
            {
                "key": configuration expression<string>,
                "pattern": pattern,
                "template": pattern
            }, ...
        ]
    }
}
```

## Properties

* `"messageType"`: *configuration expression<[enumeration](preface.html#definition-enumeration)>, required*

  The message type to extract patterns from.

  Must be `REQUEST` or `RESPONSE`.

* `"charset"`: *configuration expression<[string](preface.html#definition-string)>, optional*

  Overrides the character set encoding specified in message.

  Default: The message encoding is used.

* `"target"`: *<[lvalue-expression](preface.html#definition-lvalue-expression)>, required*

  Expression that yields the target object that contains the extraction results.

  The bindings determine what type of object is stored in the target location.

  The object stored in the target location is a Map\<String, String>. You can then access its content with `${target.key}` or `${target['key']}`.

  Learn more in [PingGateway expressions](Expressions.html).

* `"key"`: *configuration expression<[string](preface.html#definition-string)>, required*

  Name of the element in the target object to contain an extraction result.

* `"pattern"`: *[pattern](preface.html#definition-pattern), required*

  The regular expression pattern to find in the entity.

  See also [Patterns and PingGateway](Patterns.html).

* `"template"`: *[pattern-template](preface.html#definition-pattern-template), optional*

  The template to apply to the pattern, and store in the named target element.

  Default: store the match result itself.

  See also [Patterns and PingGateway](Patterns.html).

## Examples

Extracts a nonce from the response, which is typically a login page, and sets its value in the attributes context to be used by the downstream filter posting the login form. The nonce value would be accessed using the following expression: `${attributes.extract.wpLoginToken}`.

The pattern finds all matches in the HTTP body of the form `wpLogintokenvalue="abc"`. Setting the template to `$1` assigns the value `abc` to `attributes.extract.wpLoginToken`:

```json
{
    "name": "WikiNoncePageExtract",
    "type": "EntityExtractFilter",
    "config": {
        "messageType": "response",
        "target": "${attributes.extract}",
        "bindings": [
            {
                "key": "wpLoginToken",
                "pattern": "wpLoginToken\"\\s.*value=\"(.*)\"",
                "template": "$1"
            }
        ]
    }
}
```

The following example reads the response looking for the AM login page. When found, it sets `isLoginPage = true` to be used in a SwitchFilter to post the login credentials:

```json
{
    "name": "FindLoginPage",
    "type": "EntityExtractFilter",
    "config": {
        "messageType": "response",
        "target": "${attributes.extract}",
        "bindings": [
            {
                "key": "isLoginPage",
                "pattern": "OpenAM\s\(Login\)",
                "template": "true"
            }
        ]
    }
}
```
