From b682105faec7507504218faebb1846362ecf965c Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 19 Jun 2019 15:36:26 -0600 Subject: [PATCH 1/3] WIP new regexp package and functions --- .../reference/flux/functions/regexp/_index.md | 22 ++++++++++++ .../flux/functions/regexp/compile.md | 34 +++++++++++++++++++ .../flux/functions/regexp/findstring.md | 34 +++++++++++++++++++ .../flux/functions/regexp/findstringindex.md | 34 +++++++++++++++++++ .../flux/functions/regexp/getstring.md | 34 +++++++++++++++++++ .../functions/regexp/matchregexpstring.md | 34 +++++++++++++++++++ .../flux/functions/regexp/quotemeta.md | 34 +++++++++++++++++++ .../flux/functions/regexp/replaceallstring.md | 34 +++++++++++++++++++ .../flux/functions/regexp/splitregexp.md | 34 +++++++++++++++++++ 9 files changed, 294 insertions(+) create mode 100644 content/v2.0/reference/flux/functions/regexp/_index.md create mode 100644 content/v2.0/reference/flux/functions/regexp/compile.md create mode 100644 content/v2.0/reference/flux/functions/regexp/findstring.md create mode 100644 content/v2.0/reference/flux/functions/regexp/findstringindex.md create mode 100644 content/v2.0/reference/flux/functions/regexp/getstring.md create mode 100644 content/v2.0/reference/flux/functions/regexp/matchregexpstring.md create mode 100644 content/v2.0/reference/flux/functions/regexp/quotemeta.md create mode 100644 content/v2.0/reference/flux/functions/regexp/replaceallstring.md create mode 100644 content/v2.0/reference/flux/functions/regexp/splitregexp.md diff --git a/content/v2.0/reference/flux/functions/regexp/_index.md b/content/v2.0/reference/flux/functions/regexp/_index.md new file mode 100644 index 000000000..ffa655849 --- /dev/null +++ b/content/v2.0/reference/flux/functions/regexp/_index.md @@ -0,0 +1,22 @@ +--- +title: Flux regular expressions package +list_title: Regular expressions package +description: > + The Flux regular expressions package includes functions that provide enhance + regular expression functionality. Import the `regexp` package. +menu: + v2_0_ref: + name: Regular expressions + parent: Flux packages and functions +weight: 205 +v2.0/tags: [regex, functions] +--- + +The Flux regular expressions package includes functions that provide enhance +regular expression functionality. Import the `regexp` package. + +```js +import "regexp" +``` + +{{< children type="functions" show="pages" >}} diff --git a/content/v2.0/reference/flux/functions/regexp/compile.md b/content/v2.0/reference/flux/functions/regexp/compile.md new file mode 100644 index 000000000..72b476d80 --- /dev/null +++ b/content/v2.0/reference/flux/functions/regexp/compile.md @@ -0,0 +1,34 @@ +--- +title: regexp.compile() function +description: The `regexp.compile()` function ... +menu: + v2_0_ref: + name: regexp.compile + parent: Regular expressions +weight: 301 +--- + +The `regexp.compile()` function ... + +_**Output data type:** String_ + +```js +import "regexp" + +regexp.compile() +``` + +## Parameters + +### v +Desc + +_**Data type:** String_ + +## Examples + +###### ... +```js +import "regexp" + +``` diff --git a/content/v2.0/reference/flux/functions/regexp/findstring.md b/content/v2.0/reference/flux/functions/regexp/findstring.md new file mode 100644 index 000000000..4a3f40e65 --- /dev/null +++ b/content/v2.0/reference/flux/functions/regexp/findstring.md @@ -0,0 +1,34 @@ +--- +title: regexp.findString() function +description: The `regexp.findString()` function ... +menu: + v2_0_ref: + name: regexp.findString + parent: Regular expressions +weight: 301 +--- + +The `regexp.findString()` function ... + +_**Output data type:** String_ + +```js +import "regexp" + +regexp.findString() +``` + +## Parameters + +### v +Desc + +_**Data type:** String_ + +## Examples + +###### ... +```js +import "regexp" + +``` diff --git a/content/v2.0/reference/flux/functions/regexp/findstringindex.md b/content/v2.0/reference/flux/functions/regexp/findstringindex.md new file mode 100644 index 000000000..16557aa00 --- /dev/null +++ b/content/v2.0/reference/flux/functions/regexp/findstringindex.md @@ -0,0 +1,34 @@ +--- +title: regexp.findStringIndex() function +description: The `regexp.findStringIndex()` function ... +menu: + v2_0_ref: + name: regexp.findStringIndex + parent: Regular expressions +weight: 301 +--- + +The `regexp.findStringIndex()` function ... + +_**Output data type:** String_ + +```js +import "regexp" + +regexp.findStringIndex() +``` + +## Parameters + +### v +Desc + +_**Data type:** String_ + +## Examples + +###### ... +```js +import "regexp" + +``` diff --git a/content/v2.0/reference/flux/functions/regexp/getstring.md b/content/v2.0/reference/flux/functions/regexp/getstring.md new file mode 100644 index 000000000..b145ee566 --- /dev/null +++ b/content/v2.0/reference/flux/functions/regexp/getstring.md @@ -0,0 +1,34 @@ +--- +title: regexp.getString() function +description: The `regexp.getString()` function ... +menu: + v2_0_ref: + name: regexp.getString + parent: Regular expressions +weight: 301 +--- + +The `regexp.getString()` function ... + +_**Output data type:** String_ + +```js +import "regexp" + +regexp.getString() +``` + +## Parameters + +### v +Desc + +_**Data type:** String_ + +## Examples + +###### ... +```js +import "regexp" + +``` diff --git a/content/v2.0/reference/flux/functions/regexp/matchregexpstring.md b/content/v2.0/reference/flux/functions/regexp/matchregexpstring.md new file mode 100644 index 000000000..51a8cb6c1 --- /dev/null +++ b/content/v2.0/reference/flux/functions/regexp/matchregexpstring.md @@ -0,0 +1,34 @@ +--- +title: regexp.matchRegexpString() function +description: The `regexp.matchRegexpString()` function ... +menu: + v2_0_ref: + name: regexp.matchRegexpString + parent: Regular expressions +weight: 301 +--- + +The `regexp.matchRegexpString()` function ... + +_**Output data type:** String_ + +```js +import "regexp" + +regexp.matchRegexpString() +``` + +## Parameters + +### v +Desc + +_**Data type:** String_ + +## Examples + +###### ... +```js +import "regexp" + +``` diff --git a/content/v2.0/reference/flux/functions/regexp/quotemeta.md b/content/v2.0/reference/flux/functions/regexp/quotemeta.md new file mode 100644 index 000000000..27b354da8 --- /dev/null +++ b/content/v2.0/reference/flux/functions/regexp/quotemeta.md @@ -0,0 +1,34 @@ +--- +title: regexp.quoteMeta() function +description: The `regexp.quoteMeta()` function ... +menu: + v2_0_ref: + name: regexp.quoteMeta + parent: Regular expressions +weight: 301 +--- + +The `regexp.quoteMeta()` function ... + +_**Output data type:** String_ + +```js +import "regexp" + +regexp.quoteMeta() +``` + +## Parameters + +### v +Desc + +_**Data type:** String_ + +## Examples + +###### ... +```js +import "regexp" + +``` diff --git a/content/v2.0/reference/flux/functions/regexp/replaceallstring.md b/content/v2.0/reference/flux/functions/regexp/replaceallstring.md new file mode 100644 index 000000000..d5a745ade --- /dev/null +++ b/content/v2.0/reference/flux/functions/regexp/replaceallstring.md @@ -0,0 +1,34 @@ +--- +title: regexp.replaceAllString() function +description: The `regexp.replaceAllString()` function ... +menu: + v2_0_ref: + name: regexp.replaceAllString + parent: Regular expressions +weight: 301 +--- + +The `regexp.replaceAllString()` function ... + +_**Output data type:** String_ + +```js +import "regexp" + +regexp.replaceAllString() +``` + +## Parameters + +### v +Desc + +_**Data type:** String_ + +## Examples + +###### ... +```js +import "regexp" + +``` diff --git a/content/v2.0/reference/flux/functions/regexp/splitregexp.md b/content/v2.0/reference/flux/functions/regexp/splitregexp.md new file mode 100644 index 000000000..6338be78f --- /dev/null +++ b/content/v2.0/reference/flux/functions/regexp/splitregexp.md @@ -0,0 +1,34 @@ +--- +title: regexp.splitRegexp() function +description: The `regexp.splitRegexp()` function ... +menu: + v2_0_ref: + name: regexp.splitRegexp + parent: Regular expressions +weight: 301 +--- + +The `regexp.splitRegexp()` function ... + +_**Output data type:** String_ + +```js +import "regexp" + +regexp.splitRegexp() +``` + +## Parameters + +### v +Desc + +_**Data type:** String_ + +## Examples + +###### ... +```js +import "regexp" + +``` From 26e1136f26a9e3f6bbed0d9034577f378632e63c Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Mon, 24 Jun 2019 10:30:53 -0600 Subject: [PATCH 2/3] finished new regexp functions, resolves #274 --- .../reference/flux/functions/regexp/_index.md | 4 +-- .../flux/functions/regexp/compile.md | 27 +++++++++++---- .../flux/functions/regexp/findstring.md | 26 +++++++++++--- .../flux/functions/regexp/findstringindex.md | 34 +++++++++++++++---- .../flux/functions/regexp/getstring.md | 24 +++++++++---- .../functions/regexp/matchregexpstring.md | 29 ++++++++++++---- .../flux/functions/regexp/quotemeta.md | 18 +++++++--- .../flux/functions/regexp/replaceallstring.md | 34 ++++++++++++++++--- .../flux/functions/regexp/splitregexp.md | 29 ++++++++++------ 9 files changed, 172 insertions(+), 53 deletions(-) diff --git a/content/v2.0/reference/flux/functions/regexp/_index.md b/content/v2.0/reference/flux/functions/regexp/_index.md index ffa655849..e230a5c34 100644 --- a/content/v2.0/reference/flux/functions/regexp/_index.md +++ b/content/v2.0/reference/flux/functions/regexp/_index.md @@ -2,7 +2,7 @@ title: Flux regular expressions package list_title: Regular expressions package description: > - The Flux regular expressions package includes functions that provide enhance + The Flux regular expressions package includes functions that provide enhanced regular expression functionality. Import the `regexp` package. menu: v2_0_ref: @@ -12,7 +12,7 @@ weight: 205 v2.0/tags: [regex, functions] --- -The Flux regular expressions package includes functions that provide enhance +The Flux regular expressions package includes functions that provide enhanced regular expression functionality. Import the `regexp` package. ```js diff --git a/content/v2.0/reference/flux/functions/regexp/compile.md b/content/v2.0/reference/flux/functions/regexp/compile.md index 72b476d80..294d88abf 100644 --- a/content/v2.0/reference/flux/functions/regexp/compile.md +++ b/content/v2.0/reference/flux/functions/regexp/compile.md @@ -1,6 +1,8 @@ --- title: regexp.compile() function -description: The `regexp.compile()` function ... +description: > + The `regexp.compile()` function parses a regular expression and, if successful, + returns a Regexp object that can be used to match against text. menu: v2_0_ref: name: regexp.compile @@ -8,27 +10,40 @@ menu: weight: 301 --- -The `regexp.compile()` function ... +The `regexp.compile()` function parses a regular expression and, if successful, +returns a Regexp object that can be used to match against text. -_**Output data type:** String_ +_**Output data type:** Regexp_ ```js import "regexp" -regexp.compile() +regexp.compile(v: "abcd") + +// Returns the regexp object `abcd` ``` ## Parameters ### v -Desc +The string value to parse into a regular expression. _**Data type:** String_ ## Examples -###### ... +###### Use a string value as a regular expression ```js import "regexp" +data + |> map(fn: (r) => ({ + regexStr: r.regexStr, + _value: r._value, + firstRegexMatch: findString( + r: regexp.compile(v: regexStr), + v: r._value + ) + }) + ) ``` diff --git a/content/v2.0/reference/flux/functions/regexp/findstring.md b/content/v2.0/reference/flux/functions/regexp/findstring.md index 4a3f40e65..ec6747801 100644 --- a/content/v2.0/reference/flux/functions/regexp/findstring.md +++ b/content/v2.0/reference/flux/functions/regexp/findstring.md @@ -1,34 +1,50 @@ --- title: regexp.findString() function -description: The `regexp.findString()` function ... +description: The `regexp.findString()` function returns the left-most regular expression match in a string. menu: v2_0_ref: name: regexp.findString parent: Regular expressions weight: 301 +related: + - /v2.0/reference/flux/functions/regexp/splitregexp --- -The `regexp.findString()` function ... +The `regexp.findString()` function returns the left-most regular expression match in a string. _**Output data type:** String_ ```js import "regexp" -regexp.findString() +findString(r: /foo.?/, v: "seafood fool") + +// Returns "food" ``` ## Parameters +### r +The regular expression used to search `v`. + +_**Data type:** Regexp_ + ### v -Desc +The string value to search. _**Data type:** String_ ## Examples -###### ... +###### Find the first regular expression match in each row ```js import "regexp" +data + |> map(fn: (r) => ({ + message: r.message, + regexp: r.regexp, + match: regexp.findString(r: r.regexp, v: r.message) + }) + ) ``` diff --git a/content/v2.0/reference/flux/functions/regexp/findstringindex.md b/content/v2.0/reference/flux/functions/regexp/findstringindex.md index 16557aa00..17be316cc 100644 --- a/content/v2.0/reference/flux/functions/regexp/findstringindex.md +++ b/content/v2.0/reference/flux/functions/regexp/findstringindex.md @@ -1,34 +1,56 @@ --- title: regexp.findStringIndex() function -description: The `regexp.findStringIndex()` function ... +description: > + The `regexp.findStringIndex()` function returns a two-element array of integers defining + the beginning and ending indexes of the left-most regular expression match in a string. menu: v2_0_ref: name: regexp.findStringIndex parent: Regular expressions weight: 301 +related: + - /v2.0/reference/flux/functions/regexp/compile --- -The `regexp.findStringIndex()` function ... +The `regexp.findStringIndex()` function returns a two-element array of integers defining +the beginning and ending indexes of the left-most regular expression match in a string. -_**Output data type:** String_ +_**Output data type:** Array of Integers_ ```js import "regexp" -regexp.findStringIndex() +regexp.findStringIndex(r: /ab?/, v: "tablet") + +// Returns [1, 3] ``` ## Parameters +### r +The regular expression used to search `v`. + +_**Data type:** Regexp_ + ### v -Desc +The string value to search. _**Data type:** String_ ## Examples -###### ... +###### Index the bounds of first regular expression match in each row ```js import "regexp" +data + |> map(fn: (r) => ({ + regexStr: r.regexStr, + _value: r._value, + matchIndex: regexp.findStringIndex( + r: regexp.compile(r.regexStr), + v: r._value + ) + }) + ) ``` diff --git a/content/v2.0/reference/flux/functions/regexp/getstring.md b/content/v2.0/reference/flux/functions/regexp/getstring.md index b145ee566..39e5f2940 100644 --- a/content/v2.0/reference/flux/functions/regexp/getstring.md +++ b/content/v2.0/reference/flux/functions/regexp/getstring.md @@ -1,34 +1,44 @@ --- title: regexp.getString() function -description: The `regexp.getString()` function ... +description: The `regexp.getString()` function returns the source string used to compile a regular expression. menu: v2_0_ref: name: regexp.getString parent: Regular expressions weight: 301 +related: + - /v2.0/reference/flux/functions/regexp/compile --- -The `regexp.getString()` function ... +The `regexp.getString()` function returns the source string used to compile a regular expression. _**Output data type:** String_ ```js import "regexp" -regexp.getString() +regexp.getString(r: /[a-zA-Z]/) + +// Returns "[a-zA-Z]" ``` ## Parameters -### v -Desc +### r +The regular expression object to convert to a string. -_**Data type:** String_ +_**Data type:** Regexp_ ## Examples -###### ... +###### Convert regular expressions into strings in each row ```js import "regexp" +data + |> map(fn: (r) => ({ + regex: r.regex, + regexStr: regexp.getString(r: r.regex) + }) + ) ``` diff --git a/content/v2.0/reference/flux/functions/regexp/matchregexpstring.md b/content/v2.0/reference/flux/functions/regexp/matchregexpstring.md index 51a8cb6c1..4a5c39cf7 100644 --- a/content/v2.0/reference/flux/functions/regexp/matchregexpstring.md +++ b/content/v2.0/reference/flux/functions/regexp/matchregexpstring.md @@ -1,6 +1,8 @@ --- title: regexp.matchRegexpString() function -description: The `regexp.matchRegexpString()` function ... +description: > + The `regexp.matchRegexpString()` function tests if a string contains any match + to a regular expression. menu: v2_0_ref: name: regexp.matchRegexpString @@ -8,27 +10,42 @@ menu: weight: 301 --- -The `regexp.matchRegexpString()` function ... +The `regexp.matchRegexpString()` function tests if a string contains any match +to a regular expression. -_**Output data type:** String_ +_**Output data type:** Boolean_ ```js import "regexp" -regexp.matchRegexpString() +regexp.matchRegexpString(r: /(gopher){2}/, v: "gophergophergopher") + +// Returns true ``` ## Parameters +### r +The regular expression used to search `v`. + +_**Data type:** Regexp_ + ### v -Desc +The string value to search. _**Data type:** String_ ## Examples -###### ... +###### Filter by columns that contain matches to a regular expression ```js import "regexp" +data + |> filter(fn: (r) => + regexp.matchRegexpString( + r: /Alert\:/, + v: r.message + ) + ) ``` diff --git a/content/v2.0/reference/flux/functions/regexp/quotemeta.md b/content/v2.0/reference/flux/functions/regexp/quotemeta.md index 27b354da8..53821955f 100644 --- a/content/v2.0/reference/flux/functions/regexp/quotemeta.md +++ b/content/v2.0/reference/flux/functions/regexp/quotemeta.md @@ -1,6 +1,7 @@ --- title: regexp.quoteMeta() function -description: The `regexp.quoteMeta()` function ... +description: > + The `regexp.quoteMeta()` function escapes all regular expression metacharacters inside of a string. menu: v2_0_ref: name: regexp.quoteMeta @@ -8,27 +9,34 @@ menu: weight: 301 --- -The `regexp.quoteMeta()` function ... +The `regexp.quoteMeta()` function escapes all regular expression metacharacters inside of a string. _**Output data type:** String_ ```js import "regexp" -regexp.quoteMeta() +regexp.quoteMeta(v: ".+*?()|[]{}^$") + +// Returns "\.\+\*\?\(\)\|\[\]\{\}\^\$" ``` ## Parameters ### v -Desc +The string that contains regular expression metacharacters to escape. _**Data type:** String_ ## Examples -###### ... +###### Escape regular expression meta characters in column values ```js import "regexp" +data + |> map(fn: (r) => ({ + notes: r.notes, + notes_escaped: regexp.quoteMeta(v: r.notes) + })) ``` diff --git a/content/v2.0/reference/flux/functions/regexp/replaceallstring.md b/content/v2.0/reference/flux/functions/regexp/replaceallstring.md index d5a745ade..c06cc0d88 100644 --- a/content/v2.0/reference/flux/functions/regexp/replaceallstring.md +++ b/content/v2.0/reference/flux/functions/regexp/replaceallstring.md @@ -1,6 +1,8 @@ --- title: regexp.replaceAllString() function -description: The `regexp.replaceAllString()` function ... +description: > + The `regexp.replaceAllString()` function replaces all regular expression matches + in a string with a specified replacement. menu: v2_0_ref: name: regexp.replaceAllString @@ -8,27 +10,49 @@ menu: weight: 301 --- -The `regexp.replaceAllString()` function ... +The `regexp.replaceAllString()` function replaces all regular expression matches +in a string with a specified replacement. _**Output data type:** String_ ```js import "regexp" -regexp.replaceAllString() +regexp.replaceAllString(r: /a(x*)b/, v: "-ab-axxb-", t: "T") + +// Returns "-T-T-" ``` ## Parameters +### r +The regular expression used to search `v`. + +_**Data type:** Regexp_ + ### v -Desc +The string value to search. + +_**Data type:** String_ + +### t +The replacement for matches to `r`. _**Data type:** String_ ## Examples -###### ... +###### Replace regular expression matches in string column values ```js import "regexp" +data + |> map(fn: (r) => ({ + message: r.message, + updated_message: regexp.replaceAllString( + r: /cat|bird|ferret/, + v: r.message, + t: "dog" + ) + })) ``` diff --git a/content/v2.0/reference/flux/functions/regexp/splitregexp.md b/content/v2.0/reference/flux/functions/regexp/splitregexp.md index 6338be78f..28d25fdad 100644 --- a/content/v2.0/reference/flux/functions/regexp/splitregexp.md +++ b/content/v2.0/reference/flux/functions/regexp/splitregexp.md @@ -1,6 +1,8 @@ --- title: regexp.splitRegexp() function -description: The `regexp.splitRegexp()` function ... +description: > + The `regexp.splitRegexp()` function splits a string into substrings separated by + regular expression matches and returns an array of `i` substrings between matches. menu: v2_0_ref: name: regexp.splitRegexp @@ -8,27 +10,32 @@ menu: weight: 301 --- -The `regexp.splitRegexp()` function ... +The `regexp.splitRegexp()` function splits a string into substrings separated by +regular expression matches and returns an array of `i` substrings between matches. -_**Output data type:** String_ +_**Output data type:** Array of Strings_ ```js import "regexp" -regexp.splitRegexp() +regexp.splitRegexp(r: /a*/, v: "abaabaccadaaae", i: 5) + +// Returns ["", "b", "b", "c", "cadaaae"] ``` ## Parameters +### r +The regular expression used to search `v`. + +_**Data type:** Regexp_ + ### v -Desc +The string value to search. _**Data type:** String_ -## Examples +### i +The number of substrings to return. -###### ... -```js -import "regexp" - -``` +_**Data type:** Integer_ From 79e83824fe8ded2eadb8d3458b55d3a7f5c33de5 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Tue, 25 Jun 2019 16:51:11 -0600 Subject: [PATCH 3/3] added with operator to regexp function examples --- content/v2.0/reference/flux/functions/regexp/compile.md | 1 + .../v2.0/reference/flux/functions/regexp/findstring.md | 1 + .../reference/flux/functions/regexp/findstringindex.md | 1 + content/v2.0/reference/flux/functions/regexp/getstring.md | 1 + content/v2.0/reference/flux/functions/regexp/quotemeta.md | 8 +++++--- .../reference/flux/functions/regexp/replaceallstring.md | 1 + 6 files changed, 10 insertions(+), 3 deletions(-) diff --git a/content/v2.0/reference/flux/functions/regexp/compile.md b/content/v2.0/reference/flux/functions/regexp/compile.md index 294d88abf..8a5f45cca 100644 --- a/content/v2.0/reference/flux/functions/regexp/compile.md +++ b/content/v2.0/reference/flux/functions/regexp/compile.md @@ -38,6 +38,7 @@ import "regexp" data |> map(fn: (r) => ({ + r with regexStr: r.regexStr, _value: r._value, firstRegexMatch: findString( diff --git a/content/v2.0/reference/flux/functions/regexp/findstring.md b/content/v2.0/reference/flux/functions/regexp/findstring.md index ec6747801..ac0f98e86 100644 --- a/content/v2.0/reference/flux/functions/regexp/findstring.md +++ b/content/v2.0/reference/flux/functions/regexp/findstring.md @@ -42,6 +42,7 @@ import "regexp" data |> map(fn: (r) => ({ + r with message: r.message, regexp: r.regexp, match: regexp.findString(r: r.regexp, v: r.message) diff --git a/content/v2.0/reference/flux/functions/regexp/findstringindex.md b/content/v2.0/reference/flux/functions/regexp/findstringindex.md index 17be316cc..49a1d7a47 100644 --- a/content/v2.0/reference/flux/functions/regexp/findstringindex.md +++ b/content/v2.0/reference/flux/functions/regexp/findstringindex.md @@ -45,6 +45,7 @@ import "regexp" data |> map(fn: (r) => ({ + r with regexStr: r.regexStr, _value: r._value, matchIndex: regexp.findStringIndex( diff --git a/content/v2.0/reference/flux/functions/regexp/getstring.md b/content/v2.0/reference/flux/functions/regexp/getstring.md index 39e5f2940..f4528a091 100644 --- a/content/v2.0/reference/flux/functions/regexp/getstring.md +++ b/content/v2.0/reference/flux/functions/regexp/getstring.md @@ -37,6 +37,7 @@ import "regexp" data |> map(fn: (r) => ({ + r with regex: r.regex, regexStr: regexp.getString(r: r.regex) }) diff --git a/content/v2.0/reference/flux/functions/regexp/quotemeta.md b/content/v2.0/reference/flux/functions/regexp/quotemeta.md index 53821955f..7a02a2f3e 100644 --- a/content/v2.0/reference/flux/functions/regexp/quotemeta.md +++ b/content/v2.0/reference/flux/functions/regexp/quotemeta.md @@ -36,7 +36,9 @@ import "regexp" data |> map(fn: (r) => ({ - notes: r.notes, - notes_escaped: regexp.quoteMeta(v: r.notes) - })) + r with + notes: r.notes, + notes_escaped: regexp.quoteMeta(v: r.notes) + }) + ) ``` diff --git a/content/v2.0/reference/flux/functions/regexp/replaceallstring.md b/content/v2.0/reference/flux/functions/regexp/replaceallstring.md index c06cc0d88..04c7383f7 100644 --- a/content/v2.0/reference/flux/functions/regexp/replaceallstring.md +++ b/content/v2.0/reference/flux/functions/regexp/replaceallstring.md @@ -48,6 +48,7 @@ import "regexp" data |> map(fn: (r) => ({ + r with message: r.message, updated_message: regexp.replaceAllString( r: /cat|bird|ferret/,