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:
- Input: The message context properties (metadata)
- Context Property: The name of the property to extract from
- Expression: A RegEx pattern to match values
- Result: Unique value(s) extracted from the context property
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
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
- Select the 'RegEx on Message Context' expression type plugin when configuring a Search Field.
- Enter the name of the context property to extract the value from.
- Enter the RegEx expression to match/style the content. For more details, see Search Field Expressions.
- Finalize the configuration and select the Message Types to apply the expression.
- 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:
Enter a sample payload in the 'Message Body' tab
Select the 'RegEx on Message Context' plugin
Here's an example selecting the 'RegEx on Message Context' expression type plugin.Enter the name of the context property and the RegEx expression
Review the output and adjust as needed
If the expression is valid, you will see the unique values and total count:
Valid expression with state output, unique values, and total count.
If the expression is invalid or does not match any data, you will see:
Example of an invalid expression yielding no result.
Next Step
Related Topics
- What are Search Fields?
- What are Search Field Expressions?
- What are Message Types?
- What are Log Views?
- Message Context Key - Extract full context property values
- RegEx - Extract from message body instead of context
- RegEx on Message Context with capturing groups - Extract specific captured groups