{"id":15651987,"url":"https://github.com/jonschlinkert/regex-not","last_synced_at":"2025-04-13T05:13:31.840Z","repository":{"id":57352265,"uuid":"69317185","full_name":"jonschlinkert/regex-not","owner":"jonschlinkert","description":"Create a javascript regular expression for matching everything except for the given string.","archived":false,"fork":false,"pushed_at":"2018-02-20T02:37:53.000Z","size":15,"stargazers_count":31,"open_issues_count":2,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T05:13:20.787Z","etag":null,"topics":["javascript","memoize","negation","nodejs","not","regex","regular-expression"],"latest_commit_sha":null,"homepage":"https://github.com/jonschlinkert","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonschlinkert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-27T03:51:08.000Z","updated_at":"2022-10-28T15:09:20.000Z","dependencies_parsed_at":"2022-09-15T23:52:46.115Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/regex-not","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fregex-not","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fregex-not/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fregex-not/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fregex-not/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/regex-not/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665746,"owners_count":21142123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","memoize","negation","nodejs","not","regex","regular-expression"],"created_at":"2024-10-03T12:40:52.291Z","updated_at":"2025-04-13T05:13:31.819Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# regex-not [![NPM version](https://img.shields.io/npm/v/regex-not.svg?style=flat)](https://www.npmjs.com/package/regex-not) [![NPM monthly downloads](https://img.shields.io/npm/dm/regex-not.svg?style=flat)](https://npmjs.org/package/regex-not) [![NPM total downloads](https://img.shields.io/npm/dt/regex-not.svg?style=flat)](https://npmjs.org/package/regex-not) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/regex-not.svg?style=flat\u0026label=Travis)](https://travis-ci.org/jonschlinkert/regex-not)\n\n\u003e Create a javascript regular expression for matching everything except for the given string.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save regex-not\n```\n\n## Usage\n\n```js\nvar not = require('regex-not');\n```\n\nThe main export is a function that takes a string an options object.\n\n```js\nnot(string[, options]);\n```\n\n**Example**\n\n```js\nvar not = require('regex-not');\nconsole.log(not('foo'));\n//=\u003e /^(?:(?!^(?:foo)$).)+$/\n```\n\n**Strict matching**\n\nBy default, the returned regex is for strictly (not) matching the exact given pattern (in other words, \"match this string if it does NOT _exactly equal_ `foo`\"):\n\n```js\nvar re = not('foo');\nconsole.log(re.test('foo'));     //=\u003e false\nconsole.log(re.test('bar'));     //=\u003e true\nconsole.log(re.test('foobar'));  //=\u003e true\nconsole.log(re.test('barfoo'));  //=\u003e true\n```\n\n### .create\n\nReturns a string to allow you to create your own regex:\n\n```js\nconsole.log(not.create('foo'));\n//=\u003e '(?:(?!^(?:foo)$).)+'\n```\n\n### Options\n\n**options.contains**\n\nYou can relax strict matching by setting `options.contains` to true (in other words, \"match this string if it does NOT _contain_ `foo`\"):\n\n```js\nvar re = not('foo');\nconsole.log(re.test('foo', {contains: true}));     //=\u003e false\nconsole.log(re.test('bar', {contains: true}));     //=\u003e true\nconsole.log(re.test('foobar', {contains: true}));  //=\u003e false\nconsole.log(re.test('barfoo', {contains: true}));  //=\u003e false\n```\n\n## About\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eContributing\u003c/strong\u003e\u003c/summary\u003e\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRunning Tests\u003c/strong\u003e\u003c/summary\u003e\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBuilding docs\u003c/strong\u003e\u003c/summary\u003e\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n\u003c/details\u003e\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [regex-cache](https://www.npmjs.com/package/regex-cache): Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of… [more](https://github.com/jonschlinkert/regex-cache) | [homepage](https://github.com/jonschlinkert/regex-cache \"Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of the same string and options, resulting in surprising performance improvements.\")\n* [to-regex](https://www.npmjs.com/package/to-regex): Generate a regex from a string or array of strings. | [homepage](https://github.com/jonschlinkert/to-regex \"Generate a regex from a string or array of strings.\")\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 9 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 1 | [doowb](https://github.com/doowb) |\n| 1 | [EdwardBetts](https://github.com/EdwardBetts) |\n\n### Author\n\n**Jon Schlinkert**\n\n* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on February 19, 2018._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fregex-not","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Fregex-not","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fregex-not/lists"}