{"id":13393577,"url":"https://github.com/francisrstokes/super-expressive","last_synced_at":"2025-05-14T14:08:23.627Z","repository":{"id":38317893,"uuid":"279702593","full_name":"francisrstokes/super-expressive","owner":"francisrstokes","description":"🦜 Super Expressive is a zero-dependency JavaScript library for building regular expressions in (almost) natural language","archived":false,"fork":false,"pushed_at":"2024-07-05T06:32:31.000Z","size":505,"stargazers_count":4635,"open_issues_count":10,"forks_count":135,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-04-10T04:53:19.483Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/francisrstokes.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-14T22:04:33.000Z","updated_at":"2025-04-05T07:35:13.000Z","dependencies_parsed_at":"2023-02-05T23:55:12.510Z","dependency_job_id":"47633f79-74fe-4d63-b312-02b0ddac749c","html_url":"https://github.com/francisrstokes/super-expressive","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francisrstokes%2Fsuper-expressive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francisrstokes%2Fsuper-expressive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francisrstokes%2Fsuper-expressive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francisrstokes%2Fsuper-expressive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/francisrstokes","download_url":"https://codeload.github.com/francisrstokes/super-expressive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254159761,"owners_count":22024564,"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":[],"created_at":"2024-07-30T17:00:56.253Z","updated_at":"2025-05-14T14:08:23.599Z","avatar_url":"https://github.com/francisrstokes.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","📦 Legacy \u0026 Inactive Projects","Programming Languages","Libraries"],"sub_categories":["JavaScript"],"readme":"# Super Expressive\n\n![Super Expressive Logo](./logo.png)\n\n**Super Expressive** is a JavaScript library that allows you to build regular expressions in almost natural language - with no extra dependencies, and a lightweight code footprint (less than 4kb with minification + gzip!).\n\n---\n\n- [Why](#Why)\n- [Installation and Usage](#Installation-and-Usage)\n- [Example](#Example)\n- [Playground](#Playground)\n- [Ports](#Ports)\n- [API](#API)\n  \u003cdetails\u003e\n    \u003csummary\u003eClick to expand\u003c/summary\u003e\n\n  - [SuperExpressive()](#SuperExpressive)\n  - [.allowMultipleMatches](#allowMultipleMatches)\n  - [.lineByLine](#lineByLine)\n  - [.caseInsensitive](#caseInsensitive)\n  - [.generateIndices](#generateIndices)\n  - [.sticky](#sticky)\n  - [.unicode](#unicode)\n  - [.singleLine](#singleLine)\n  - [.anyChar](#anyChar)\n  - [.whitespaceChar](#whitespaceChar)\n  - [.nonWhitespaceChar](#nonWhitespaceChar)\n  - [.digit](#digit)\n  - [.nonDigit](#nonDigit)\n  - [.word](#word)\n  - [.nonWord](#nonWord)\n  - [.wordBoundary](#wordBoundary)\n  - [.nonWordBoundary](#nonWordBoundary)\n  - [.newline](#newline)\n  - [.carriageReturn](#carriageReturn)\n  - [.tab](#tab)\n  - [.verticalTab](#verticalTab)\n  - [.formFeed](#formFeed)\n  - [.backspace](#backspace)\n  - [.nullByte](#nullByte)\n  - [.anyOf](#anyOf)\n  - [.capture](#capture)\n  - [.namedCapture(name)](#namedCapturename)\n  - [.backreference(index)](#backreferenceindex)\n  - [.namedBackreference(index)](#namedBackreferenceindex)\n  - [.group](#group)\n  - [.end()](#end())\n  - [.assertAhead](#assertAhead)\n  - [.assertNotAhead](#assertNotAhead)\n  - [.assertBehind](#assertBehind)\n  - [.assertNotBehind](#assertNotBehind)\n  - [.optional](#optional)\n  - [.zeroOrMore](#zeroOrMore)\n  - [.zeroOrMoreLazy](#zeroOrMoreLazy)\n  - [.oneOrMore](#oneOrMore)\n  - [.oneOrMoreLazy](#oneOrMoreLazy)\n  - [.exactly(n)](#exactlyn)\n  - [.atLeast(n)](#atLeastn)\n  - [.atLeastLazy(n)](#atLeastLazyn)\n  - [.between(x, y)](#betweenx-y)\n  - [.betweenLazy(x, y)](#betweenLazyx-y)\n  - [.startOfInput](#startOfInput)\n  - [.endOfInput](#endOfInput)\n  - [.anyOfChars(chars)](#anyOfCharschars)\n  - [.anythingBut](#anythingBut)\n  - [.anythingButChars(chars)](#anythingButCharschars)\n  - [.anythingButString(str)](#anythingButStringstr)\n  - [.anythingButRange(a, b)](#anythingButRangea-b)\n  - [.string(s)](#strings)\n  - [.char(c)](#charc)\n  - [.controlChar(c)](#controlCharc)\n  - [.hexCode(hex)](#hexCodehex)\n  - [.utf16Code(hex)](#utf16Codehex)\n  - [.unicodeCharCode(hex)](#unicodeCharCodehex)\n  - [.unicodeProperty(property)](#unicodePropertyproperty)\n  - [.notUnicodeProperty(property)](#notUnicodePropertyproperty)\n  - [.range(a, b)](#rangea-b)\n  - [.subexpression(expr, opts)](#subexpressionexpr-opts)\n  - [.toRegexString()](#toRegexString)\n  - [.toRegex()](#toRegex)\n  \u003c/details\u003e\n\n## Why?\n\nRegex is a very powerful tool, but its terse and cryptic vocabulary can make constructing and communicating them with others a challenge. Even developers who understand them well can have trouble reading their own back just a few months later! In addition, they can't be easily created and manipulated in a programmatic way - closing off an entire avenue of dynamic text processing.\n\nThat's where **Super Expressive** comes in. It provides a programmatic and human readable way to create regular expressions. It's API uses the [fluent builder pattern](https://en.wikipedia.org/wiki/Fluent_interface), and is completely immutable. It's built to be discoverable and predictable:\n\n- properties and methods describe what they do in plain English\n- order matters! quantifiers are specified before the thing they change, just like in English (e.g. `SuperExpressive().exactly(5).digit`)\n- if you make a mistake, you'll know how to fix it. SuperExpressive will guide you towards a fix if your expression is invalid\n- [subexpressions](#subexpressionexpr-opts) can be used to create meaningful, reusable components\n- includes an `index.d.ts` file for full TypeScript support\n\nSuperExpressive turns those complex and unwieldy regexes that appear in code reviews into something that can be read, understood, and **properly reviewed** by your peers - and maintained by anyone!\n\n## Installation and Usage\n\n```\nnpm i super-expressive\n```\n\n```JavaScript\nconst SuperExpressive = require('super-expressive');\n\n// Or as an ES6 module\nimport SuperExpressive from 'super-expressive';\n```\n\n## Example\n\nThe following example recognises and captures the value of a 16-bit hexadecimal number like `0xC0D3`.\n\n```javascript\nconst SuperExpressive = require('super-expressive');\n\nconst myRegex = SuperExpressive()\n  .startOfInput\n  .optional.string('0x')\n  .capture\n    .exactly(4).anyOf\n      .range('A', 'F')\n      .range('a', 'f')\n      .range('0', '9')\n    .end()\n  .end()\n  .endOfInput\n  .toRegex();\n\n// Produces the following regular expression:\n/^(?:0x)?([A-Fa-f0-9]{4})$/\n```\n\n## Playground\n\nYou can experiment with `SuperExpressive` in the [Super Expressive Playground](https://nartc.github.io/ng-super-expressive/) by [@nartc](https://github.com/nartc). This is a great way to build a regex description, and test it against various inputs.\n\n\u003cimg src=\"playground-small.jpg\"\u003e\n\n## Ports\n\nSuper Expressive has been ported to the following languages:\n\n### PHP\n\nhttps://github.com/bassim/super-expressive-php by \u003ca href=\"https://github.com/bassim/\"\u003e@bassim\u003c/a\u003e\n\n### Ruby\n\nhttps://github.com/hiy/super-expressive-ruby by \u003ca href=\"https://github.com/hiy\"\u003e@hiy\u003c/a\u003e\n\n### Python\n\nhttps://github.com/stanislav-tsaplev/super_expressive by \u003ca href=\"https://github.com/stanislav-tsaplev\"\u003e@stanislav-tsaplev\u003c/a\u003e\n\n## API\n\n### SuperExpressive()\n\n`SuperExpressive()`\n\nCreates an instance of `SuperExpressive`.\n\n### .allowMultipleMatches\n\nUses the `g` flag on the regular expression, which indicates that it should match multiple values when run on a string.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .allowMultipleMatches\n  .string('hello')\n  .toRegex();\n// -\u003e\n/hello/g\n```\n\n### .lineByLine\n\nUses the `m` flag on the regular expression, which indicates that it should treat the [.startOfInput](#startOfInput) and [.endOfInput](#endOfInput) markers as the start and end of lines.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .lineByLine\n  .string('^hello$')\n  .toRegex();\n// -\u003e\n/\\^hello\\$/m\n```\n\n### .caseInsensitive\n\nUses the `i` flag on the regular expression, which indicates that it should treat ignore the uppercase/lowercase distinction when matching.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .caseInsensitive\n  .string('HELLO')\n  .toRegex();\n// -\u003e\n/HELLO/i\n```\n\n### .generateIndices\n\nUses the `d` flag on the regular expression, which indicates that it should generate indices for the start and end of each capture group.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .generateIndices\n  .string('hello')\n  .toRegex();\n// -\u003e\n/hello/d\n```\n\n### .sticky\n\nUses the `y` flag on the regular expression, which indicates that it should create a stateful regular expression that can be resumed from the last match.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .sticky\n  .string('hello')\n  .toRegex();\n// -\u003e\n/hello/y\n```\n\n### .unicode\n\nUses the `u` flag on the regular expression, which indicates that it should use full unicode matching.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .unicode\n  .string('héllo')\n  .toRegex();\n// -\u003e\n/héllo/u\n```\n\n### .singleLine\n\nUses the `s` flag on the regular expression, which indicates that the input should be treated as a single line, where the [.startOfInput](#startOfInput) and [.endOfInput](#endOfInput) markers explicitly mark the start and end of input, and [.anyChar](#anyChar) also matches newlines.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .singleLine\n  .string('hello')\n  .anyChar\n  .string('world')\n  .toRegex();\n// -\u003e\n/hello.world/s\n```\n\n### .anyChar\n\nMatches any single character. When combined with [.singleLine](#singleLine), it also matches newlines.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .anyChar\n  .toRegex();\n// -\u003e\n/./\n```\n\n### .whitespaceChar\n\nMatches any whitespace character, including the special whitespace characters: `\\r\\n\\t\\f\\v`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .whitespaceChar\n  .toRegex();\n// -\u003e\n/\\s/\n```\n\n### .nonWhitespaceChar\n\nMatches any non-whitespace character, excluding also the special whitespace characters: `\\r\\n\\t\\f\\v`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .nonWhitespaceChar\n  .toRegex();\n// -\u003e\n/\\S/\n```\n\n### .digit\n\nMatches any digit from `0-9`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .digit\n  .toRegex();\n// -\u003e\n/\\d/\n```\n\n### .nonDigit\n\nMatches any non-digit.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .nonDigit\n  .toRegex();\n// -\u003e\n/\\D/\n```\n\n### .word\n\nMatches any alpha-numeric (`a-z, A-Z, 0-9`) characters, as well as `_`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .word\n  .toRegex();\n// -\u003e\n/\\w/\n```\n### .nonWord\n\nMatches any non alpha-numeric (`a-z, A-Z, 0-9`) characters, excluding `_` as well.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .nonWord\n  .toRegex();\n// -\u003e\n/\\W/\n```\n\n### .wordBoundary\n\nMatches (without consuming any characters) immediately between a character matched by [.word](#word) and a character not matched by [.word](#word) (in either order).\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .digit\n  .wordBoundary\n  .toRegex();\n// -\u003e\n/\\d\\b/\n```\n\n### .nonWordBoundary\n\nMatches (without consuming any characters) at the position between two characters matched by [.word](#word).\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .digit\n  .nonWordBoundary\n  .toRegex();\n// -\u003e\n/\\d\\B/\n```\n\n### .newline\n\nMatches a `\\n` character.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .newline\n  .toRegex();\n// -\u003e\n/\\n/\n```\n\n### .carriageReturn\n\nMatches a `\\r` character.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .carriageReturn\n  .toRegex();\n// -\u003e\n/\\r/\n```\n\n### .tab\n\nMatches a `\\t` character.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .tab\n  .toRegex();\n// -\u003e\n/\\t/\n```\n\n### .verticalTab\n\nMatches a `\\v` character.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .verticalTab\n  .toRegex();\n// -\u003e\n/\\v/\n```\n\n### .formFeed\n\nMatches a `\\f` character.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .formFeed\n  .toRegex();\n// -\u003e\n/\\f/\n```\n\n### .backspace\n\nMatches a `\\b` character.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .backspace\n  .toRegex();\n// -\u003e\n/[\\b]/\n```\n\n### .nullByte\n\nMatches a `\\u0000` character (ASCII `0`).\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .nullByte\n  .toRegex();\n// -\u003e\n/\\0/\n```\n\n### .anyOf\n\nMatches a choice between specified elements. Needs to be finalised with `.end()`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .anyOf\n    .range('a', 'f')\n    .range('0', '9')\n    .string('XXX')\n  .end()\n  .toRegex();\n// -\u003e\n/(?:XXX|[a-f0-9])/\n```\n\n### .capture\n\nCreates a capture group for the proceeding elements. Needs to be finalised with `.end()`. Can be later referenced with [backreference(index)](#backreferenceindex).\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .capture\n    .range('a', 'f')\n    .range('0', '9')\n    .string('XXX')\n  .end()\n  .toRegex();\n// -\u003e\n/([a-f][0-9]XXX)/\n```\n\n### .namedCapture(name)\n\nCreates a named capture group for the proceeding elements. Needs to be finalised with `.end()`. Can be later referenced with [namedBackreference(name)](#namedBackreferencename) or [backreference(index)](#backreferenceindex).\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .namedCapture('interestingStuff')\n    .range('a', 'f')\n    .range('0', '9')\n    .string('XXX')\n  .end()\n  .toRegex();\n// -\u003e\n/(?\u003cinterestingStuff\u003e[a-f][0-9]XXX)/\n```\n\n### .namedBackreference(name)\n\nMatches exactly what was previously matched by a [namedCapture](#namedCapturename).\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .namedCapture('interestingStuff')\n    .range('a', 'f')\n    .range('0', '9')\n    .string('XXX')\n  .end()\n  .string('something else')\n  .namedBackreference('interestingStuff')\n  .toRegex();\n// -\u003e\n/(?\u003cinterestingStuff\u003e[a-f][0-9]XXX)something else\\k\u003cinterestingStuff\u003e/\n```\n\n### .backreference(index)\n\nMatches exactly what was previously matched by a [capture](#capture) or [namedCapture](#namedCapturename) using a positional index. Note regex indexes start at 1, so the first capture group has index 1.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .capture\n    .range('a', 'f')\n    .range('0', '9')\n    .string('XXX')\n  .end()\n  .string('something else')\n  .backreference(1)\n  .toRegex();\n// -\u003e\n/([a-f][0-9]XXX)something else\\1/\n```\n\n### .group\n\nCreates a non-capturing group of the proceeding elements. Needs to be finalised with `.end()`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .optional.group\n    .range('a', 'f')\n    .range('0', '9')\n    .string('XXX')\n  .end()\n  .toRegex();\n// -\u003e\n/(?:[a-f][0-9]XXX)?/\n```\n\n### .end()\n\nSignifies the end of a SuperExpressive grouping, such as [.anyOf](#anyOf), [.group](#group), or [.capture](#capture).\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .capture\n    .anyOf\n      .range('a', 'f')\n      .range('0', '9')\n      .string('XXX')\n    .end()\n  .end()\n  .toRegex();\n// -\u003e\n/((?:XXX|[a-f0-9]))/\n```\n\n### .assertAhead\n\nAssert that the proceeding elements are found without consuming them. Needs to be finalised with `.end()`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .assertAhead\n    .range('a', 'f')\n  .end()\n  .range('a', 'z')\n  .toRegex();\n// -\u003e\n/(?=[a-f])[a-z]/\n```\n\n### .assertNotAhead\n\nAssert that the proceeding elements are **not** found without consuming them. Needs to be finalised with `.end()`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .assertNotAhead\n    .range('a', 'f')\n  .end()\n  .range('g', 'z')\n  .toRegex();\n// -\u003e\n/(?![a-f])[g-z]/\n```\n\n### .assertBehind\n\nAssert that the elements contained within **are** found immediately before this point in the string. Needs to be finalised with `.end()`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .assertBehind\n    .string('hello ')\n  .end()\n  .string('world')\n  .toRegex();\n// -\u003e\n/(?\u003c=hello )world/\n```\n\n### .assertNotBehind\n\nAssert that the elements contained within are **not** found immediately before this point in the string. Needs to be finalised with `.end()`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .assertNotBehind\n    .string('hello ')\n  .end()\n  .string('world')\n  .toRegex();\n// -\u003e\n/(?\u003c!hello )world/\n```\n\n### .optional\n\nAssert that the proceeding element may or may not be matched.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .optional.digit\n  .toRegex();\n// -\u003e\n/\\d?/\n```\n\n### .zeroOrMore\n\nAssert that the proceeding element may not be matched, or may be matched multiple times.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .zeroOrMore.digit\n  .toRegex();\n// -\u003e\n/\\d*/\n```\n\n### .zeroOrMoreLazy\n\nAssert that the proceeding element may not be matched, or may be matched multiple times, but as few times as possible.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .zeroOrMoreLazy.digit\n  .toRegex();\n// -\u003e\n/\\d*?/\n```\n\n### .oneOrMore\n\nAssert that the proceeding element may be matched once, or may be matched multiple times.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .oneOrMore.digit\n  .toRegex();\n// -\u003e\n/\\d+/\n```\n\n### .oneOrMoreLazy\n\nAssert that the proceeding element may be matched once, or may be matched multiple times, but as few times as possible.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .oneOrMoreLazy.digit\n  .toRegex();\n// -\u003e\n/\\d+?/\n```\n\n### .exactly(n)\n\nAssert that the proceeding element will be matched exactly `n` times.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .exactly(5).digit\n  .toRegex();\n// -\u003e\n/\\d{5}/\n```\n\n### .atLeast(n)\n\nAssert that the proceeding element will be matched at least `n` times.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .atLeast(5).digit\n  .toRegex();\n// -\u003e\n/\\d{5,}/\n```\n\n### .atLeastLazy(n)\n\nAssert that the proceeding element will be matched at least `n` times, but as few times as possible.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .atLeastLazy(5).digit\n  .toRegex();\n// -\u003e\n/\\d{5,}?/\n```\n\n### .between(x, y)\n\nAssert that the proceeding element will be matched somewhere between `x` and `y` times.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .between(3, 5).digit\n  .toRegex();\n// -\u003e\n/\\d{3,5}/\n```\n\n### .betweenLazy(x, y)\n\nAssert that the proceeding element will be matched somewhere between `x` and `y` times, but as few times as possible.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .betweenLazy(3, 5).digit\n  .toRegex();\n// -\u003e\n/\\d{3,5}?/\n```\n\n### .startOfInput\n\nAssert the start of input, or the start of a line when [.lineByLine](#lineByLine) is used.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .startOfInput\n  .string('hello')\n  .toRegex();\n// -\u003e\n/^hello/\n```\n\n### .endOfInput\n\nAssert the end of input, or the end of a line when [.lineByLine](#lineByLine) is used.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .string('hello')\n  .endOfInput\n  .toRegex();\n// -\u003e\n/hello$/\n```\n\n### .anyOfChars(chars)\n\nMatches any of the characters in the provided string `chars`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .anyOfChars('aeiou')\n  .toRegex();\n// -\u003e\n/[aeiou]/\n```\n\n### .anythingBut\n\nMatches any character, except those that match any of the specified elements. Needs to be finalised with `.end()`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .anythingBut\n    .digit\n    .range('a','z')\n    .string('XXX')\n  .end()\n  .toRegex();\n// -\u003e\n/(?:(?!XXX)[^\\da-z])/\n```\n\n### .anythingButChars(chars)\n\nMatches any character, except any of those in the provided string `chars`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .anythingButChars('aeiou')\n  .toRegex();\n// -\u003e\n/[^aeiou]/\n```\n\n### .anythingButString(str)\n\nMatches any string the same length as `str`, except the characters sequentially defined in `str`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .anythingButString('aeiou')\n  .toRegex();\n// -\u003e\n/(?:[^a][^e][^i][^o][^u])/\n```\n\n### .anythingButRange(a, b)\n\nMatches any character, except those that would be captured by the [.range](#rangea-b) specified by `a` and `b`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .anythingButRange(0, 9)\n  .toRegex();\n// -\u003e\n/[^0-9]/\n```\n\n### .string(s)\n\nMatches the exact string `s`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .string('hello')\n  .toRegex();\n// -\u003e\n/hello/\n```\n\n### .char(c)\n\nMatches the exact character `c`.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .char('x')\n  .toRegex();\n// -\u003e\n/x/\n```\n\n### .controlChar(c)\n\nMatches a control character using carat notation (`Ctrl^c`) where `c` is a single latin letter from A-Z.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .controlChar('J')\n  .toRegex();\n// -\u003e\n/\\cJ/\n```\n\n### .hexCode(hex)\n\nMatches a character with the code `hex`, where `hex` is a 2 dogit hexadecimal string.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .hexCode('2A')\n  .toRegex();\n// -\u003e\n/\\x2A/\n```\n\n### .utf16Code(hex)\n\nMatches a UTF-16 code unit with the code `hex`, where `hex` is a 4 digit hexadecimal string.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .utf16Code('002A')\n  .toRegex();\n// -\u003e\n/\\u002A/\n```\n\n### .unicodeCharCode(hex)\n\nMatches a Unicode character code with the value `hex`, where `hex` is a 4 or 5 digit hexadecimal string.\nImplicitly enables the `u` flag on the regular expression.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .unicodeCharCode('0002A')\n  .toRegex();\n// -\u003e\n/\\u{0002A}/u\n```\n\n### .unicodeProperty(property)\n\nMatches a Unicode character with the given Unicode property.\nSee the [MDN Docs](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape) for valid properties.\nImplicitly enables the `u` flag on the regular expression.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .unicodeProperty('Script=Latin')\n  .toRegex();\n// -\u003e\n/\\p{Script=Latin}/u\n```\n\n### .notUnicodeProperty(property)\n\nMatches a Unicode character without the given Unicode property.\nSee the [MDN Docs](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape) for valid properties.\nImplicitly enables the `u` flag on the regular expression.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .notUnicodeProperty('Script=Latin')\n  .toRegex();\n// -\u003e\n/\\P{Script=Latin}/u\n```\n\n### .range(a, b)\n\nMatches any character that falls between `a` and `b`. Ordering is defined by a characters ASCII or unicode value.\nThe `u` flag is automatically enabled if either `a` or `b` are unicode characters larger than 2 bytes.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .range('a', 'z')\n  .range('\\u{1F600}', '\\u{1F606}')\n  .toRegex();\n// -\u003e\n/[a-z][😀-😆]/u\n```\n\n### .subexpression(expr, opts?)\n\n- *opts.namespace*: A **string** namespace to use on all named capture groups in the subexpression, to avoid naming collisions with your own named groups (default = `''`)\n- *opts.ignoreFlags*: If set to true, any flags this subexpression specifies should be disregarded (default = `true`)\n- *opts.ignoreStartAndEnd*: If set to true, any startOfInput/endOfInput asserted in this subexpression specifies should be disregarded (default = `true`)\n\nMatches another SuperExpressive instance inline. Can be used to create libraries, or to modularise you code. By default, flags and start/end of input markers are ignored, but can be explcitly turned on in the options object.\n\n**Example**\n```JavaScript\n// A reusable SuperExpressive...\nconst fiveDigits = SuperExpressive().exactly(5).digit;\n\nSuperExpressive()\n  .oneOrMore.range('a', 'z')\n  .atLeast(3).anyChar\n  .subexpression(fiveDigits)\n  .toRegex();\n// -\u003e\n/[a-z]+.{3,}\\d{5}/\n```\n\n\n### .toRegexString()\n\nOutputs a string representation of the regular expression that this SuperExpression models.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .allowMultipleMatches\n  .lineByLine\n  .startOfInput\n  .optional.string('0x')\n  .capture\n    .exactly(4).anyOf\n      .range('A', 'F')\n      .range('a', 'f')\n      .range('0', '9')\n    .end()\n  .end()\n  .endOfInput\n  .toRegexString();\n// -\u003e\n\"/^(?:0x)?([A-Fa-f0-9]{4})$/gm\"\n```\n\n### .toRegex()\n\nOutputs the regular expression that this SuperExpression models.\n\n**Example**\n```JavaScript\nSuperExpressive()\n  .allowMultipleMatches\n  .lineByLine\n  .startOfInput\n  .optional.string('0x')\n  .capture\n    .exactly(4).anyOf\n      .range('A', 'F')\n      .range('a', 'f')\n      .range('0', '9')\n    .end()\n  .end()\n  .endOfInput\n  .toRegex();\n// -\u003e\n/^(?:0x)?([A-Fa-f0-9]{4})$/gm\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrancisrstokes%2Fsuper-expressive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrancisrstokes%2Fsuper-expressive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrancisrstokes%2Fsuper-expressive/lists"}