- 4 minutes to read

RegEx on Message Context Search Field Expression Plugin

Easily extract unique values from context properties using the RegEx on Message Context Search Field Expression Plugin. This page shows you how to configure, test, and use this plugin with clear input, configuration, and result examples.

✅ Extract single or multiple unique values from named context properties ✅ Use powerful RegEx expressions for advanced extraction ✅ Works with HTTP headers, BizTalk context properties, and custom metadata ✅ Designed for high performance and self-service Log Views

🎯 Design Note: Perfect for extracting patterns from filenames, URLs, or formatted context values!


What does the RegEx on Message Context plugin do?

The RegEx on Message Context plugin lets you extract one or more unique values from context properties (metadata) of Log Events. Unlike Message Context Key which returns the full property value, this plugin applies RegEx patterns to extract specific parts.

Key Features:

Info

Use Case: Extract filenames from file paths, extract IDs from URLs, or parse formatted context property values like FileName, RequestURL, or custom metadata.

  • Extract values from named context properties using RegEx patterns
  • Works with HTTP headers, file paths, URLs, and BizTalk context
  • Support for multiple matches within a single context value
  • Ideal for parsing structured metadata values

Tip

Use Message Context Key for simple key-based lookup. Use this plugin when you need pattern-based extraction from context values.


How it works

The RegEx on Message Context plugin processes messages in four steps:

  1. Input: The message context properties (metadata)
  2. Context Property: The name of the property to extract from
  3. Expression: A RegEx pattern to match values
  4. Result: Unique value(s) extracted from the context property
graph LR A["Input: Message Context"] --> B["Context Property Name"] B --> C["RegEx Pattern"] C --> D["Result: Matched Values"]

The plugin retrieves the specified context property value, then applies the RegEx pattern to extract matches.


Example

Context Property Name:

FileName

Property Value:

\\nodinitesrv01\ftp\public\INT001\Order\OrderFile_123.xml

RegEx Expression:

([^\\]+$)

Result:

OrderFile_123.xml

Tip

The pattern ([^\\]+$) matches everything after the last backslash, effectively extracting the filename from a file path.


Examples

Example 1: Extract File Name from Context Property Using RegEx

Input:

\\nodinitesrv01\ftp\public\INT001\Order\OrderFile_123.xml

Context Property:

FileName

RegEx Expression:

([^\\]+$)

Result:

OrderFile_123.xml

Test Expression Valid expression with state output, unique values, and total count.


Features

  • Extract single or multiple unique values from named context properties
  • Use RegEx expressions to match and style data
  • Designed for small payloads and high performance

Note

This plugin loads the entire message into RAM. Only use it for small payloads.


How to Use

  1. Select the 'RegEx on Message Context' expression type plugin when configuring a Search Field.
  2. Enter the name of the context property to extract the value from.
  3. Enter the RegEx expression to match/style the content. For more details, see Search Field Expressions.
  4. Finalize the configuration and select the Message Types to apply the expression.
  5. Optionally, perform a re-index operation (Add or manage Search Field).

Extracted values are stored for as long as the Message Type retention is configured.


Test Expression

You can test your configuration in the 'Test Expression' tab when setting up a Search Field:

  1. Enter a sample payload in the 'Message Body' tab

  2. Select the 'RegEx on Message Context' plugin

    Select Here's an example selecting the 'RegEx on Message Context' expression type plugin.

  3. Enter the name of the context property and the RegEx expression

  4. Review the output and adjust as needed

If the expression is valid, you will see the unique values and total count:

Test Expression Valid expression with state output, unique values, and total count.

If the expression is invalid or does not match any data, you will see:

No Result Example of an invalid expression yielding no result.


Next Step