{"id":19504001,"url":"https://github.com/mysticatea/regexpp","last_synced_at":"2025-05-16T02:07:23.890Z","repository":{"id":29492506,"uuid":"121845360","full_name":"mysticatea/regexpp","owner":"mysticatea","description":"The regular expression parser for ECMAScript.","archived":false,"fork":false,"pushed_at":"2023-04-30T13:02:28.000Z","size":298,"stargazers_count":156,"open_issues_count":12,"forks_count":16,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-01T09:01:41.666Z","etag":null,"topics":["abstract-syntax-tree","ecmascript","javascript","parser","regexp"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/mysticatea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"mysticatea"}},"created_at":"2018-02-17T10:16:31.000Z","updated_at":"2025-03-31T15:33:22.000Z","dependencies_parsed_at":"2022-09-06T08:53:32.856Z","dependency_job_id":"278a2b7b-28c8-4394-8feb-de602cdd32e1","html_url":"https://github.com/mysticatea/regexpp","commit_stats":{"total_commits":50,"total_committers":5,"mean_commits":10.0,"dds":0.52,"last_synced_commit":"b8bc4e82885a9cff44b908d247685cde129cd863"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mysticatea%2Fregexpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mysticatea%2Fregexpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mysticatea%2Fregexpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mysticatea%2Fregexpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mysticatea","download_url":"https://codeload.github.com/mysticatea/regexpp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253077488,"owners_count":21850331,"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":["abstract-syntax-tree","ecmascript","javascript","parser","regexp"],"created_at":"2024-11-10T22:23:55.705Z","updated_at":"2025-05-16T02:07:23.871Z","avatar_url":"https://github.com/mysticatea.png","language":"TypeScript","readme":"# regexpp\n\n[![npm version](https://img.shields.io/npm/v/regexpp.svg)](https://www.npmjs.com/package/regexpp)\n[![Downloads/month](https://img.shields.io/npm/dm/regexpp.svg)](http://www.npmtrends.com/regexpp)\n[![Build Status](https://github.com/mysticatea/regexpp/workflows/CI/badge.svg)](https://github.com/mysticatea/regexpp/actions)\n[![codecov](https://codecov.io/gh/mysticatea/regexpp/branch/master/graph/badge.svg)](https://codecov.io/gh/mysticatea/regexpp)\n[![Dependency Status](https://david-dm.org/mysticatea/regexpp.svg)](https://david-dm.org/mysticatea/regexpp)\n\nA regular expression parser for ECMAScript.\n\n## 💿 Installation\n\n```bash\n$ npm install regexpp\n```\n\n- require Node.js 8 or newer.\n\n## 📖 Usage\n\n```ts\nimport {\n    AST,\n    RegExpParser,\n    RegExpValidator,\n    RegExpVisitor,\n    parseRegExpLiteral,\n    validateRegExpLiteral,\n    visitRegExpAST\n} from \"regexpp\"\n```\n\n### parseRegExpLiteral(source, options?)\n\nParse a given regular expression literal then make AST object.\n\nThis is equivalent to `new RegExpParser(options).parseLiteral(source)`.\n\n- **Parameters:**\n    - `source` (`string | RegExp`) The source code to parse.\n    - `options?` ([`RegExpParser.Options`]) The options to parse.\n- **Return:**\n    - The AST of the regular expression.\n\n### validateRegExpLiteral(source, options?)\n\nValidate a given regular expression literal.\n\nThis is equivalent to `new RegExpValidator(options).validateLiteral(source)`.\n\n- **Parameters:**\n    - `source` (`string`) The source code to validate.\n    - `options?` ([`RegExpValidator.Options`]) The options to validate.\n\n### visitRegExpAST(ast, handlers)\n\nVisit each node of a given AST.\n\nThis is equivalent to `new RegExpVisitor(handlers).visit(ast)`.\n\n- **Parameters:**\n    - `ast` ([`AST.Node`]) The AST to visit.\n    - `handlers` ([`RegExpVisitor.Handlers`]) The callbacks.\n\n### RegExpParser\n\n#### new RegExpParser(options?)\n\n- **Parameters:**\n    - `options?` ([`RegExpParser.Options`]) The options to parse.\n\n#### parser.parseLiteral(source, start?, end?)\n\nParse a regular expression literal.\n\n- **Parameters:**\n    - `source` (`string`) The source code to parse. E.g. `\"/abc/g\"`.\n    - `start?` (`number`) The start index in the source code. Default is `0`.\n    - `end?` (`number`) The end index in the source code. Default is `source.length`.\n- **Return:**\n    - The AST of the regular expression.\n\n#### parser.parsePattern(source, start?, end?, uFlag?)\n\nParse a regular expression pattern.\n\n- **Parameters:**\n    - `source` (`string`) The source code to parse. E.g. `\"abc\"`.\n    - `start?` (`number`) The start index in the source code. Default is `0`.\n    - `end?` (`number`) The end index in the source code. Default is `source.length`.\n    - `uFlag?` (`boolean`) The flag to enable Unicode mode.\n- **Return:**\n    - The AST of the regular expression pattern.\n\n#### parser.parseFlags(source, start?, end?)\n\nParse a regular expression flags.\n\n- **Parameters:**\n    - `source` (`string`) The source code to parse. E.g. `\"gim\"`.\n    - `start?` (`number`) The start index in the source code. Default is `0`.\n    - `end?` (`number`) The end index in the source code. Default is `source.length`.\n- **Return:**\n    - The AST of the regular expression flags.\n\n### RegExpValidator\n\n#### new RegExpValidator(options)\n\n- **Parameters:**\n    - `options` ([`RegExpValidator.Options`]) The options to validate.\n\n#### validator.validateLiteral(source, start, end)\n\nValidate a regular expression literal.\n\n- **Parameters:**\n    - `source` (`string`) The source code to validate.\n    - `start?` (`number`) The start index in the source code. Default is `0`.\n    - `end?` (`number`) The end index in the source code. Default is `source.length`.\n\n#### validator.validatePattern(source, start, end, uFlag)\n\nValidate a regular expression pattern.\n\n- **Parameters:**\n    - `source` (`string`) The source code to validate.\n    - `start?` (`number`) The start index in the source code. Default is `0`.\n    - `end?` (`number`) The end index in the source code. Default is `source.length`.\n    - `uFlag?` (`boolean`) The flag to enable Unicode mode.\n\n#### validator.validateFlags(source, start, end)\n\nValidate a regular expression flags.\n\n- **Parameters:**\n    - `source` (`string`) The source code to validate.\n    - `start?` (`number`) The start index in the source code. Default is `0`.\n    - `end?` (`number`) The end index in the source code. Default is `source.length`.\n\n### RegExpVisitor\n\n#### new RegExpVisitor(handlers)\n\n- **Parameters:**\n    - `handlers` ([`RegExpVisitor.Handlers`]) The callbacks.\n\n#### visitor.visit(ast)\n\nValidate a regular expression literal.\n\n- **Parameters:**\n    - `ast` ([`AST.Node`]) The AST to visit.\n\n## 📰 Changelog\n\n- [GitHub Releases](https://github.com/mysticatea/regexpp/releases)\n\n## 🍻 Contributing\n\nWelcome contributing!\n\nPlease use GitHub's Issues/PRs.\n\n### Development Tools\n\n- `npm test` runs tests and measures coverage.\n- `npm run build` compiles TypeScript source code to `index.js`, `index.js.map`, and `index.d.ts`.\n- `npm run clean` removes the temporary files which are created by `npm test` and `npm run build`.\n- `npm run lint` runs ESLint.\n- `npm run update:test` updates test fixtures.\n- `npm run update:ids` updates `src/unicode/ids.ts`.\n- `npm run watch` runs tests with `--watch` option.\n\n[`AST.Node`]: src/ast.ts#L4\n[`RegExpParser.Options`]: src/parser.ts#L539\n[`RegExpValidator.Options`]: src/validator.ts#L127\n[`RegExpVisitor.Handlers`]: src/visitor.ts#L204\n","funding_links":["https://github.com/sponsors/mysticatea"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmysticatea%2Fregexpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmysticatea%2Fregexpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmysticatea%2Fregexpp/lists"}