{"id":13812717,"url":"https://github.com/tc39/proposal-regexp-modifiers","last_synced_at":"2025-04-15T01:34:37.945Z","repository":{"id":38297306,"uuid":"417422474","full_name":"tc39/proposal-regexp-modifiers","owner":"tc39","description":"Regular Expression Pattern Modifiers for ECMAScript","archived":false,"fork":false,"pushed_at":"2024-10-08T06:37:54.000Z","size":601,"stargazers_count":46,"open_issues_count":4,"forks_count":4,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-28T13:21:56.417Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://arai-a.github.io/ecma262-compare/?pr=3221","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tc39.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":"2021-10-15T08:20:44.000Z","updated_at":"2024-12-17T22:38:57.000Z","dependencies_parsed_at":"2024-08-04T04:02:45.937Z","dependency_job_id":"19944675-7fb1-4754-9552-fd682326285d","html_url":"https://github.com/tc39/proposal-regexp-modifiers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tc39%2Fproposal-regexp-modifiers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tc39%2Fproposal-regexp-modifiers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tc39%2Fproposal-regexp-modifiers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tc39%2Fproposal-regexp-modifiers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tc39","download_url":"https://codeload.github.com/tc39/proposal-regexp-modifiers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248989448,"owners_count":21194586,"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-08-04T04:00:54.798Z","updated_at":"2025-04-15T01:34:37.924Z","avatar_url":"https://github.com/tc39.png","language":"HTML","funding_links":[],"categories":["JavaScript regex evolution"],"sub_categories":["Regex processors, utilities, and more"],"readme":"\u003c!--#region:intro--\u003e\r\n# Regular Expression Pattern Modifiers for ECMAScript\r\n\r\n\u003c!--#endregion:intro--\u003e\r\n\r\n\u003c!--#region:status--\u003e\r\n## Status\r\n\r\n**Stage:** 4  \r\n**Champion:** Ron Buckton ([@rbuckton](https://github.com/rbuckton))  \r\n\r\n_For detailed status of this proposal see [TODO](#todo), below._  \r\n\u003c!--#endregion:status--\u003e\r\n\r\n\u003c!--#region:authors--\u003e\r\n## Authors\r\n\r\n* Ron Buckton ([@rbuckton](https://github.com/rbuckton))  \r\n\u003c!--#endregion:authors--\u003e\r\n\r\n\u003c!--#region:motivations--\u003e\r\n# Motivations\r\n\r\nOne common capability amongst the majority of regular expression engines that\r\nis commonly used by parsers, syntax highlighters, and other tools is the capability to\r\ncontrol a subset of regular expression flags such as:\r\n\r\n- `i` \u0026mdash; Ignore Case\r\n- `m` \u0026mdash; Multiline\r\n- `s` \u0026mdash; Single-line (a.k.a. \"dot all\")\r\n- `x` \u0026mdash; Extended mode (see https://github.com/rbuckton/proposal-regexp-x-mode)\r\n\r\nModifiers are especially helpful when regular expressions are defined in a context\r\nwhere executable code cannot be evaluated, such as a JSON configuration file or \r\nTextMate tmLanguage grammar file.\r\n\r\nAs part of this proposal, we will investigate each existing (and future-proposed) RegExp flag\r\nto determine whether they are feasible to used as modifiers.\r\n\r\n\u003c!--#endregion:motivations--\u003e\r\n\r\n\u003c!--#region:prior-art--\u003e\r\n# Prior Art \r\n\r\n* [Perl](https://rbuckton.github.io/regexp-features/engines/perl.html#feature-modifiers)  \r\n* [PCRE](https://rbuckton.github.io/regexp-features/engines/pcre.html#feature-modifiers)  \r\n* [Boost.Regex](https://rbuckton.github.io/regexp-features/engines/boost.regex.html#feature-modifiers)  \r\n* [.NET](https://rbuckton.github.io/regexp-features/engines/dotnet.html#feature-modifiers)  \r\n* [Oniguruma](https://rbuckton.github.io/regexp-features/engines/oniguruma.html#feature-modifiers)  \r\n* [Hyperscan](https://rbuckton.github.io/regexp-features/engines/hyperscan.html#feature-modifiers)  \r\n* [ICU](https://rbuckton.github.io/regexp-features/engines/icu.html#feature-modifiers)  \r\n* [Glib/GRegex](https://rbuckton.github.io/regexp-features/engines/glib-gregex.html#feature-modifiers)  \r\n\r\nSee https://rbuckton.github.io/regexp-features/features/modifiers.html for additional information.\r\n\u003c!--#endregion:prior-art--\u003e\r\n\r\n\u003c!--#region:syntax--\u003e\r\n# Syntax\r\n\r\nModifiers allow you to change the currently active RegExp flags within a subexpression.\r\n\r\n- `(?imsx-imsx:subexpression)` \u0026mdash; Sets or unsets (using `-`) the specified RegExp flags for the subexpression.\r\n- ~~`(?imsx-imsx)` \u0026mdash; Sets or unsets (using `-`) the specified RegExp flags starting at the current position until the next closing `)` or the end of the pattern.~~\r\n\r\n\u003e NOTE: Certain flags cannot be modified mid-expression. These currently include `g` (global), `y` (sticky), `u` (unicode), and `d` (hasIndices).\r\n\r\n\u003e NOTE: The actual supported flags will be determined on a case-by-case basis. See [#1](https://github.com/tc39/proposal-regexp-modifiers/issues/1).\r\n\r\n\u003e NOTE: This has no conflicts with existing syntax, as ECMAScript currently produces an error for this syntax in both `u` and non-`u` modes.\r\n\r\n\u003e NOTE: The \"self-bounded\" form (`(?imsx-imsx:subexpression)`) advanced to Stage 2 on December 15th, 2021.\r\n\r\n\u003e NOTE: The \"unbounded\" form (`(?imsx-imsx)`) is no longer being considered as part of this proposal as of December 15th, 2021.\r\n\r\n\u003c!--#endregion:syntax--\u003e\r\n\r\n\u003c!--#region:semantics--\u003e\r\n\u003c!-- # Semantics --\u003e\r\n\r\n\r\n\u003c!--#endregion:semantics--\u003e\r\n\r\n\u003c!--#region:examples--\u003e\r\n# Examples\r\n\r\n```js\r\nconst re1 = /^[a-z](?-i:[a-z])$/i;\r\nre1.test(\"ab\"); // true\r\nre1.test(\"Ab\"); // true\r\nre1.test(\"aB\"); // false\r\n\r\nconst re2 = /^(?i:[a-z])[a-z]$/;\r\nre2.test(\"ab\"); // true\r\nre2.test(\"Ab\"); // true\r\nre2.test(\"aB\"); // false\r\n```\r\n\r\n\u003c!--#endregion:examples--\u003e\r\n\r\n\u003c!--#region:api--\u003e\r\n\u003c!--\r\n# API\r\n\r\n\u003e TODO: Provide description of High-level API.\r\n--\u003e\r\n\u003c!--#endregion:api--\u003e\r\n\r\n\u003c!--#region:grammar--\u003e\r\n\u003c!-- # Grammar\r\n\r\n```grammarkdown\r\n``` --\u003e\r\n\u003c!--#endregion:grammar--\u003e\r\n\r\n\u003c!--#region:references--\u003e\r\n\u003c!-- # References\r\n\r\n\u003e TODO: Provide links to other specifications, etc.\r\n\r\n* [Title](url)   --\u003e\r\n\u003c!--#endregion:references--\u003e\r\n\r\n# History\r\n\r\n- October 27th, 2021 \u0026mdash; Proposed for Stage 1 ([slides](https://1drv.ms/p/s!AjgWTO11Fk-Tkfl7c6yR-2P8T4gn0w?e=cvaUL2))\r\n  - Outcome: Advanced to Stage 1\r\n- December 15th, 2021 \u0026mdash; Proposed for Stage 2 ([slides](https://1drv.ms/p/s!AjgWTO11Fk-Tkfs3yIyrh3hZ2k6PCQ?e=Yodx4H))\r\n  - Outcome: Advanced to Stage 2 with \"self-bounded\" form only (\"unbounded\" form did not advance).\r\n  - Stage 2 Reviewers: Richard Gibson, Waldemar Horwat\r\n- June 7th, 2022 \u0026mdash; Proposed for Stage 3 ([slides](https://1drv.ms/p/s!AjgWTO11Fk-Tkf5daRnRsxu8BY5Nsg?e=UKVf8W))\r\n  - Outcome: [Advanced to Stage 3](https://github.com/tc39/notes/blob/31edb829db604fdb0255b21238b20898b66cee41/meetings/2022-06/jun-07.md)\r\n\r\n\u003c!--#region:todo--\u003e\r\n# TODO\r\n\r\nThe following is a high-level list of tasks to progress through each stage of the [TC39 proposal process](https://tc39.github.io/process-document/):\r\n\r\n### Stage 1 Entrance Criteria\r\n\r\n* [x] Identified a \"[champion][Champion]\" who will advance the addition.  \r\n* [x] [Prose][Prose] outlining the problem or need and the general shape of a solution.  \r\n* [x] Illustrative [examples][Examples] of usage.  \r\n* [ ] ~~High-level [API][API].~~  \r\n\r\n### Stage 2 Entrance Criteria\r\n\r\n* [x] [Initial specification text][Specification].  \r\n* [ ] ~~[Transpiler support][Transpiler] (_Optional_)~~.  \r\n\r\n### Stage 2.7 Entrance Criteria\r\n\r\n* [x] [Complete specification text][Specification].  \r\n* [x] Designated reviewers have [signed off][Stage3ReviewerSignOff] on the current spec text (1 of 2).  \r\n* [x] The ECMAScript editor has [signed off][Stage3EditorSignOff] on the current spec text.  \r\n\r\n### Stage 3 Entrance Criteria\r\n\r\n* [x] [Test262](https://github.com/tc39/test262) acceptance tests have been written for mainline usage scenarios and [merged][Test262PullRequest].  \r\n\r\n### Stage 4 Entrance Criteria\r\n\r\n* [x] Two compatible implementations which pass the acceptance tests:  \r\n  * [X] [V8][Implementation1] - Shipping in [Chrome 125](https://developer.chrome.com/release-notes/125)/Edge 125\r\n  * [x] [SpiderMonkey][Implementation2] - Shipping in FireFox 130 behind a flag, Shipping in FireFox 132b (Nightly) [unflagged](https://bugzilla.mozilla.org/show_bug.cgi?id=1913752)\r\n  * [ ] JSC  \r\n  * [ ] [Engine262](https://github.com/engine262/engine262/pull/229)  \r\n* [x] A [pull request][Ecma262PullRequest] has been sent to tc39/ecma262 with the integrated spec text.  \r\n* [ ] The ECMAScript editor has signed off on the [pull request][Ecma262PullRequest].  \r\n  * [x] [Kevin Gibbons](https://github.com/tc39/ecma262/pull/3221#pullrequestreview-1735554031)  \r\n  * [ ] [Michael Ficarra](https://github.com/tc39/ecma262/pull/3221#pullrequestreview-1784954743)  \r\n\u003c!--#endregion:todo--\u003e\r\n\r\n\u003c!-- The following links are used throughout the README: --\u003e\r\n\r\n[Process]: https://tc39.es/process-document/\r\n[Proposals]: https://github.com/tc39/proposals/\r\n[Grammarkdown]: http://github.com/rbuckton/grammarkdown#readme\r\n[Champion]: #status\r\n[Prose]: #motivations\r\n[Examples]: #examples\r\n[API]: #api\r\n[Specification]: https://rbuckton.github.io/proposal-regexp-modifiers\r\n\r\n[Transpiler]: #todo\r\n[Stage3ReviewerSignOff]: #todo\r\n[Stage3EditorSignOff]: #todo\r\n[Test262PullRequest]: https://github.com/tc39/test262/pull/3960\r\n[Implementation1]: https://bugs.chromium.org/p/v8/issues/detail?id=12956\r\n[Implementation2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1899813\r\n[Ecma262PullRequest]: https://github.com/tc39/ecma262/pull/3221\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftc39%2Fproposal-regexp-modifiers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftc39%2Fproposal-regexp-modifiers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftc39%2Fproposal-regexp-modifiers/lists"}