regexp.quoteMeta() function
The regexp.quoteMeta()
function escapes all regular expression metacharacters inside of a string.
Output data type: String
import "regexp"
regexp.quoteMeta(v: ".+*?()|[]{}^$")
// Returns "\.\+\*\?\(\)\|\[\]\{\}\^\$"
Parameters
v
The string that contains regular expression metacharacters to escape.
Examples
Escape regular expression meta characters in column values
import "regexp"
data
|> map(fn: (r) => ({r with notes: r.notes, notes_escaped: regexp.quoteMeta(v: r.notes)}))
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.