RegEx search field expression type plugin

Use this plugin to extract values from small messages

The Nodinite RegEx Search Field Expression Type plugin can be used to match/style one or more unique values from payload in your logged documents.

  • Flat files
  • EDI/X12
  • XML

A Logged message comes from a Log Event that is part of the Logging feature of Nodinite and the Search Fields are further used within self service enabled Log Views for your business.

Quick example

Let's get you started with the following simple demonstration example valid for this search field plugin. For other and more advanced examples please scroll down on this page to the Examples section.

Input Expression Result
<ns0:Orders xmlns:ns0="Common.Schemas/Nodinite/1.0">
    <Order>
        <Id>101</Id>
        <Amount>1337</Amount>
        <City CityId="054">Karlstad</City>
    </Order>
    <Order>
        <Id>102</Id>
        <Amount>10</Amount>
        <City CityId="08">Stockholm</City>
    </Order>
</ns0:Orders>
cityId="([0-9]+)"
CityId="054"
CityId="08"
XML Data RegEx expression Unique values

Features

  • Extract single or multiple unique values from messages (payload)
  • Use any RegEx expression to match and/or style data

This plugin loads the entire message into RAM, so make make sure to apply this extraction method on smaller messages only


How to use

In order to extract values from XML messages you must first configure the Search Field, in this example case; The City part:

Once a Search Field is configured, values are extracted either during normal processing or from user initiated re-index operations. Extracted values are persisted and stored for as long as the days to keep events property on the Message Type is configured.

Test Expression

You can test an expression when configuring a Search Field in the 'Test Expression' tab

  1. Enter an appropriate payload in the 'Message Body' tab
  2. Select the 'RegEx' expression type plugin
    SelectPlugin
  3. Enter valid RegEx expression (You can also click on elements/attributes to get a suggestion)
  4. Review result/output, rewrite the code in step 3 until you get the data you seek

Values will be automatically extracted by the Logging Service and then presented together with the evaluated processing state and the number of unique matches.

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

If the expression is either invalid or does not match any data, then the following output is presented:
NoResult
Invalid expression yields no result

Examples

graph LR subgraph "Search Fields" sf(fal:fa-search-plus Order Number) end subgraph "Search Field Expressions" sfe(fal:fa-flask RegEx plugin) end subgraph "MessageTypes" mt1(fal:fa-file Orders) end sf --- sfe sfe ---|Expression| mt1

Basic example #1: XML

To extract all Ids for cities with for the Message Type 'Common.Schemas/Nodinite/1.0#Orders' you can use the following valid expression 'cityId="([0-9]+)"'. This expression yields the unique values CityId="054" and CityId="08"

Message Body

<ns0:Orders xmlns:ns0="Common.Schemas/Nodinite/1.0">
    <Order>
        <Id>101</Id>
        <Amount>1337</Amount>
        <City CityId="054">Karlstad</City>
    </Order>
    <Order>
        <Id>102</Id>
        <Amount>10</Amount>
        <City CityId="08">Stockholm</City>
    </Order>
</ns0:Orders>

Expression

cityId="([0-9]+)"

Additional examples

Concatenation, which describes a sequence of sub expressions and matches results with the expression only.

Example: if "h" is the Expression and "how" is the Message Type Data, the result will be that "h" is a match.

Alternatives, which is described by a vertical line, |, is used to match at least one alternative.

Example: "dog|cat" matches both "dog" and "cat".

Iteration, which is described by an asterisk, *, is used to match an expression which is repeated 0 or more times.

Example: "go*gle" has an infinite number of matches which includes: "ggle", "gogle", "google", "gooogle" and so on.

Grouping of expressions, which is done with parentheses.

Example: a(ero|ir)plane will match both aeroplane and airplane.

Matching is described by brackets and uses one of some characters followed by certain characters.

Example: [lsh][]and matches land, sand, and hand.

A dot, ., can be used as all characters.

Example: writing ten dots will give you all unique results with ten different characters in every paragraph.

Next Step

How to Add or manage Search Fields
How to Add or manage Log Views

Expression Type Plugins are used in Search Fields
What are Search Fields?
What are Search Field Expressions?
What are Message Types?
What are Log Views?