query
On this page

escapeRegex

lib.strings.escapeRegex

Docs pulled from | This Revision | 16 minutes ago


Turn a string s into an exact regular expression

Inputs

s
1. Function argument

Type

escapeRegex :: string -> string

Examples

lib.strings.escapeRegex usage example

escapeRegex "[^a-z]*"
=> "\\[\\^a-z]\\*"

Noogle detected

Aliases

Implementation

This function is implemented in c++ and is part of the native nix runtime.

Implementation

The following is the current implementation of this function.

escapeRegex = escape (stringToCharacters "\\[{()^$?*+|.");