Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/asabya/escape_string_regexp

Escape RegExp special characters
https://github.com/asabya/escape_string_regexp

Last synced: 2 days ago
JSON representation

Escape RegExp special characters

Awesome Lists containing this project

README

        

Ported from https://github.com/sindresorhus/escape-string-regexp

# escape-string-regexp
[![Build Status](https://travis-ci.org/Sab94/escape_string_regexp.svg?branch=master)](https://travis-ci.org/Sab94/escape_string_regexp)

Escape RegExp special characters

## Usage

```typescript
import { escapeStringRegexp } from 'https://raw.githubusercontent.com/Sab94/escape-string-regexp/master/mod.ts'

const a = escapeStringRegexp('\\ ^ $ * + ? . ( ) | { } [ ]');
console.log(a)

//result: '\\\\ \\^ \\$ \\* \\+ \\? \\. \\( \\) \\| \\{ \\} \\[ \\]'
```

## License

MIT