Skip to content

Commit

Permalink
Update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffail committed Nov 15, 2019
1 parent 8303e63 commit b3a53b2
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.

## Unreleased

### Added

- New `regexp_expand` operator added to the `text` processor.

## 3.4.0 - 2019-11-12

### Added
Expand Down
33 changes: 30 additions & 3 deletions docs/processors/README.md
Expand Up @@ -1855,9 +1855,36 @@ for control characters and other non-printable characters.

#### `regexp_expand`

Expands the template variables with the matched occurrences of the regular
expression in a message. Inside the value $ signs are interpreted as submatch
expansions, e.g. $1 represents the text of the first submatch.
Expands each matched occurrence of the argument regular expression according to
a template specified with the `value` field, and replaces the message
with the aggregated results.

Inside the template $ signs are interpreted as submatch expansions, e.g. $1
represents the text of the first submatch.

For example, given the following config:

```yaml
- text:
operator: regexp_expand
arg: "(?m)(?P<key>\\w+):\\s+(?P<value>\\w+)$"
value: "$key=$value\n"
```

And a message containing:

```text
option1: value1
# comment line
option2: value2
```

The resulting payload would be:

```text
option1=value1
option2=value2
```

#### `replace`

Expand Down
33 changes: 30 additions & 3 deletions lib/processor/text.go
Expand Up @@ -87,9 +87,36 @@ for control characters and other non-printable characters.
#### ` + "`regexp_expand`" + `
Expands the template variables with the matched occurrences of the regular
expression in a message. Inside the value $ signs are interpreted as submatch
expansions, e.g. $1 represents the text of the first submatch.
Expands each matched occurrence of the argument regular expression according to
a template specified with the ` + "`value`" + ` field, and replaces the message
with the aggregated results.
Inside the template $ signs are interpreted as submatch expansions, e.g. $1
represents the text of the first submatch.
For example, given the following config:
` + "```yaml" + `
- text:
operator: regexp_expand
arg: "(?m)(?P<key>\\w+):\\s+(?P<value>\\w+)$"
value: "$key=$value\n"
` + "```" + `
And a message containing:
` + "```text" + `
option1: value1
# comment line
option2: value2
` + "```" + `
The resulting payload would be:
` + "```text" + `
option1=value1
option2=value2
` + "```" + `
#### ` + "`replace`" + `
Expand Down

0 comments on commit b3a53b2

Please sign in to comment.