How to use RegEx

How to use RegEx

How to use Regular Expressions (RegEx)

In Crosser you can filter or split messages based on rules and conditions with different operators. For advanced use cases, it might be required to use more complex rules to fulfill the requirement. For such purposes, the operator ‘Regular Expressions’ (RegEx) can be used to filter, split or route messages. This article describes the capabilities of RegEx in Crosser and how to use them.

General information

Since Crosser is based on .NET, the solution supports RegEx capabilities that .NET offers. Beside that, the solution supports only ‘Inline-Characters’ as per attached documentation from Microsoft.
https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-options

Example

Let's say you have two inputs and want to filter incoming messages so that only messages can pass, where the property ‘name’ includes ‘machine’, followed by ‘/’, four numbers between 0 and 9 and you also don’t care about case-sensitivity.

The corresponding RegEx with ‘Inline-Characters’ would be: 

(?i)(machine)\/[0-9]{4}

Flow



RegEx as Message Filter

You can apply the RegEx as a filter on any module in the ‘Common’ tab of the module settings.

Result

As a result, the left message will pass into the module while the right message will be dropped.




Only messages that match the RegEx will be able to pass through the module.


Note: RegEx can be verified and tested in external tools such as https://regex101.com/ with sample input and expressions. Keep in mind that only ‘Inline-Characters’ are supported, i.e. global settings are not supported. 



    • Related Articles

    • Analytics Modules Overview

      Analytics Modules Overview This section presents the analytics modules available in the Crosser Module library. Analytics modules are used to transform and harmonize message formats from different sources, as well as operate on the actual message ...
    • Module Updates

      This document contains a history of module updates in Crosser Control Center. 2024-03-28 New Azure Event Hubs Publisher [1.0.0] - This module publishes message data to Azure Event Hubs. Updates InfluxDB v2 Insert [1.1.1] - Fixed precision settings ...
    • Crosser Module Library

      Crosser Module Library This document presents the currently available standard modules for use with the Crosser Edge Node. The module library is constantly expanded with new modules. New modules are typically developed in a time frame of days to ...
    • Support for Node version 3.0

      Release Note Crosser Control Center Release date: 2023-10-31 Node 3.0 Support Control Center now supports the new Node version 3.0, see xxx for more information on the new Node. To use version 3.0 Nodes your Flows must be configured to use version ...
    • New Flows page

      April 28, 2022 New Flows page with categories The Flows page has got a major overhaul with a new look and feel, improved usability and the addition of categories to help you organize your flows. You can now create your own hierarchical categories in ...