regex FilterΒΆ

The foglamp-filter-regex plugin is a simple filter that allows the user to find asset name, datapoint name or values in string type datapoints and replace them with new values. It uses regular expressions to match and replaces these values with replacement values.

A set of find and replace expressions are given in an expression map.

When adding filter a configuration page for the filter will be shown as below;

regex_1

Scope The scope to apply the filter on. There are three scopes

  • String Datapoints: Value of datapoints of string type can be modified

  • Asset Name: Asset name can be modified

  • Datapoint Name: Datapoint name can be modified

The Expressions Map JSON requires expressions as an array of objects, where each object can have following attributes,

  • asset: Apply filter to only specified asset if present, otherwise apply to all the assets

  • datapoint: Apply filter to only specified datapoint if present, otherwise apply to all the datapoints

  • match: A regular expression to match

  • replace: A new value as a replacement (backreferences are supported in replacement), if given regular expression matches