- 4 minutes to read

RegEx on Message Context with Capturing Groups Plugin

Easily extract unique values from context properties using the RegEx on Message Context with Capturing Groups 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 with capturing groups for advanced extraction ✅ Works with HTTP headers, BizTalk context properties, and custom metadata ✅ Designed for high performance and self-service log views

🎯 Design Note: Combines the power of context properties with capturing groups for precise metadata extraction!


What does the RegEx on Message Context with Capturing Groups plugin do?

The RegEx on Message Context with Capturing Groups plugin lets you extract specific parts from context properties (metadata) of Log Events. It combines RegEx on Message Context with capturing groups to extract only the matched portions.

Key Features:

Info

Use Case: Extract the 4th field from a pipe-delimited context value, extract IDs from formatted strings, or parse structured metadata.

  • Extract specific parts from named context properties using capturing groups
  • Support for global and multiline matching options
  • Specify which capturing group to extract (1, 2, 3, etc.)
  • Works with HTTP headers, file paths, URLs, and BizTalk context

Tip

Use RegEx on Message Context to extract the full match. Use this plugin to extract only the captured group content.


How it works

The RegEx on Message Context with Capturing Groups plugin processes messages in five steps:

  1. Input: The message context properties (metadata)
  2. Context Property: The name of the property to extract from
  3. Expression: A RegEx pattern with capturing groups ()
  4. Group Selection: Which capturing group to extract (1, 2, 3, etc.)
  5. Result: Unique value(s) from the specified capturing group
graph LR A["Input: Message Context"] --> B["Context Property Name"] B --> C["RegEx Pattern + Groups"] C --> D["Result: Captured Values"]

The plugin retrieves the context property value, applies the RegEx pattern, and extracts only the captured group content.


Example

Context Property Name:

OrderRecord

Property Value:

ORD|101|ExampleCompany1|456|Company Name ACME|...

RegEx Expression:

^(?:(.*?)\|){4}

Configuration:

  • RegEx groups = 1
  • Global = Checked
  • Multi line = Unchecked

Result:

456

Tip

This pattern extracts the 4th field from a pipe-delimited string by capturing the content before the 4th pipe character.


Examples

Example 1: Extract the 4th Field from a Context Property Using RegEx

Input:

ORD|101|ExampleCompany1|456|Company Name ACME|Dieselgate valley 1|123 45|Flameburg|

Context Property:

OrderRecord

RegEx Expression:

^(?:(.*?)\|){4}

Result:

456

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 with capturing groups, global, and multiline options
  • 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 with capturing groups' 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.
    • RegEx groups: Enter the number or name of RegEx group(s) to return (leave empty for all matches)
    • Global: When checked, do not return on first match
    • Multi line: When checked, use ^ for start of line and $ for end of line
  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 with capturing groups' plugin
    Select
    Here's an example selecting the 'RegEx on Message Context with capturing groups' 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.



Mermaid Diagram: Search Field Expression Flow

This diagram shows how the RegEx on Message Context with capturing groups plugin fits into the overall search field expression process.

graph LR subgraph "Search Fields" sf(fal:fa-magnifying-glass-plus Order Number) end subgraph "Search Field Expressions" sfe(fal:fa-flask RegEx on Message Context with capturing groups plugin) end subgraph "MessageTypes" mt1(fal:fa-file Orders) end sf --- sfe sfe --- | Expression | mt1

Next Step