Skip to main content

Getting Started

You can get up and running quickly. The API is intentionally small, and TypeScript types make integration straightforward.

Requirements

  • Node.js 18+
  • An active commercial subscription
  • npm, pnpm, or yarn

Install

Install from npm using the package name included with your subscription:

npm install @r101/parser

Core API

The primary entry points are:

const regexTokens = parseRegex(regex, opts);
const substitutionTokens = parseSubst(regex, opts);

TypeScript definitions describe the full API surface, so editor tooling and autocomplete are available from the start.

Example

import { parseRegex } from '@r101/parser';

const pattern = '^(?<name>[a-z]+)-(?<id>\\d+)$';
const result = parseRegex(pattern, { flavor: 'pcre2', flags: 'm' });

// result includes typed AST

Runtime compatibility

  • Browser: supported
  • Node.js: supported
  • Module formats: ESM and CJS
  • Tree shaking: supported

Next steps