Regex-not

regex-not

Match everything except

How many times have you encouraged this sistuation where in you had to match everything execpt a particular string?

regex-not creates a regular expression for matching everything except for the given string.

Get it: npm install regex-not

Sample usage:

1
2
3
4
5
6
7
const regexNot = require('regex-not');
const notFoo = regexNot('foo');
//=> /^(?:(?!^(?:foo)$).)*$/

notFoo.test("foo"); //false

notFoo.test("foobar"); // true

GIF FTW

regex-not

Suggest a module

Comments