regexp.quoteMeta() function

The regexp.quoteMeta() function escapes all regular expression metacharacters inside of a string.

*Output data type: String*

  1. import "regexp"
  2. regexp.quoteMeta(v: ".+*?()|[]{}^$")
  3. // Returns "\.\+\*\?\(\)\|\[\]\{\}\^\$"

Parameters

v

The string that contains regular expression metacharacters to escape.

*Data type: String*

Examples

Escape regular expression meta characters in column values
  1. import "regexp"
  2. data
  3. |> map(fn: (r) => ({
  4. r with
  5. notes: r.notes,
  6. notes_escaped: regexp.quoteMeta(v: r.notes)
  7. })
  8. )