regexp.findString() function
The regexp.findString()
function returns the left-most regular expression match in a string.
Output data type: String
import "regexp"
regexp.findString(r: /foo.?/, v: "seafood fool")
// Returns "food"
Parameters
r
The regular expression used to search v
.
v
The string value to search.
Examples
Find the first regular expression match in each row
import "regexp"
data
|> map(fn: (r) => ({r with
message: r.message,
regexp: r.regexp,
match: regexp.findString(r: r.regexp, v: r.message)
})
)
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
InfluxDB Cloud customers can contact InfluxData Support.