Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add documentation about match_regex #1246

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions concepts/data-pipeline/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,25 @@ Routing is flexible enough to support _wildcard_ in the **Match** pattern. The b
```

The match rule is set to **my\_\*** which means it will match any Tag that starts with **my\_**.

## Routing with Regex

Routing also provides support for _regex_ with the **Match_Regex** pattern, allowing for more complex and precise matching criteria.
The following example demonstrates how to route data from sources based on a regular expression:

```
[INPUT]
Name temperature_sensor
Tag temp_sensor_A

[INPUT]
Name humidity_sensor
Tag humid_sensor_B

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably add another input we do not want to match to demonstrate it a little.

[OUTPUT]
Name stdout
Match_regex .*_sensor_[AB]
```

In this configuration, the **Match_regex** rule is set to `.*_sensor_[AB]`. This regular expression will match any Tag that ends with "_sensor_A" or "_sensor_B", regardless of what precedes it.
This approach provides a more flexible and powerful way to handle different source tags with a single routing rule.