Documentation

regexp.quoteMeta() function

regexp.quoteMeta() escapes all regular expression metacharacters in a string.

Function type signature
(v: string) => string

For more information, see Function type signatures.

Parameters

v

(Required) String that contains regular expression metacharacters to escape.

Examples

Escape regular expression metacharacters in a string

import "regexp"

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

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more