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.
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
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}
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.