- 4 minutes to read

XPath with RegEx Search Field Expression Plugin

Unlock powerful XML data extraction and transformation using the XPath with RegEx Search Field Expression plugin. This page shows you how to combine XPath and RegEx to extract, match, and style values from XML messages—making your log data more actionable and searchable.

✅ Extract single or multiple unique values from XML messages ✅ Apply RegEx to filter or transform extracted data ✅ Efficiently process large XML payloads with a high-performance, forward-only stream reader ✅ Works with BizTalk, SOAP, REST APIs, and any XML format

🎯 Design Note: Perfect for extracting parts of XML values, like filenames from paths or IDs from formatted strings!


What does the XPath with RegEx plugin do?

The XPath with RegEx plugin combines the power of XPath navigation with RegEx pattern matching. First, it uses XPath to select elements or attributes from XML messages. Then, it applies a RegEx pattern to the extracted values to further filter or transform the result.

Key Features:

Info

Use Case: Extract a filename from a full path in XML, extract IDs from formatted strings, or filter XML values with RegEx patterns.

  • Use XPath 1.0 to select elements or attributes from XML
  • Apply RegEx patterns to extracted values
  • High-performance, forward-only stream reader for large XML payloads
  • Return unique values for use in Search Fields and Log Views

Tip

Use XPath for simple XML extraction. Use this plugin when you need additional RegEx filtering on the extracted values.


How it works

The XPath with RegEx plugin processes XML messages in four steps:

  1. Input: The XML message payload
  2. XPath Expression: Navigates to the target element or attribute
  3. RegEx Pattern: Filters or transforms the extracted value
  4. Result: Unique value(s) after XPath extraction and RegEx filtering
graph LR A["Input: XML Payload"] --> B["XPath Expression"] B --> C["RegEx Pattern"] C --> D["Result: Filtered Values"]

The plugin first uses XPath to extract values from XML, then applies RegEx to filter or transform those values.


Example

Input:

<ns0:Orders xmlns:ns0="Common.Schemas/Nodinite/1.0">
    <Header>
        <FileName>\\nodinitesrv01\ftp\public\INT001\Order\OrderFile_123.xml</FileName>
    </Header>
    <Order>
        <Id>101</Id>
        <Amount>1000</Amount>
        <City>Karlstad</City>
    </Order>
</ns0:Orders>

XPath Expression:

Orders/Header/FileName

RegEx Pattern:

([^\\]+$)

Result:

OrderFile_123.xml

Tip

XPath extracts the full path \\nodinitesrv01\ftp\public\INT001\Order\OrderFile_123.xml, then RegEx extracts just the filename after the last backslash.

OrderFile_123.xml

Example 2: Extracting Node Names from XML Content

Goal: Extract all node names from a nested XML structure.

Input

<Envelope>
    <Any>
        <Nodes>
            <node1 id="1">
                <node2/>
            </node1>
        </Nodes>
    </Any>
</Envelope>

Expression 1: XPath

Envelope/Any/Nodes

Expression 2: RegEx

<([a-z0-9]{0,})

Result

node1
node2

How to Configure the Plugin

  1. Select the XPath with RegEx expression type plugin when adding or editing a Search Field.
  2. Enter your XPath expression to select the XML element or attribute.
  3. (Optional) Enter a RegEx pattern to further filter or style the extracted value(s).
  4. Adjust RegEx group and global options as needed.
  5. Test your configuration using the Test Expression tab.
  6. Save and apply the Search Field to your Message Types.

Troubleshooting & Tips

  • Not all XPath expressions are supported—only forward navigation is allowed due to the stream reader.
  • If your expression returns no result, check for typos or unsupported XPath features.
  • Use the Test Expression feature to validate your XPath and RegEx before saving.

Visual Overview

graph LR subgraph "Search Fields" sf(fal:fa-magnifying-glass-plus File name) end subgraph "Search Field Expressions" sfe(fal:fa-flask XPath with RegEx plugin) end subgraph "MessageTypes" mt1(fal:fa-file Orders) end sf --- sfe sfe ---|Expression configuration| mt1

Diagram: How Search Fields, Expressions, and Message Types connect in Nodinite.


Screenshots

Select XPath with RegEx Plugin
Selecting the XPath with RegEx plugin in the Search Field configuration.

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

No Result
Example of an invalid expression, which yields no result.

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


Next Step