A TypeScript library providing a Python-like re interface for regex operations, targeting evergreen browsers. The API closely mirrors Python’s re module, with seamless support for both JavaScript and Python-only regex features.
- Pythonic API:
re.match,re.search,re.compile,re.sub,re.split,re.findall,re.fullmatch,re.escape - Automatic backend selection:
- Uses Pyodide and Python’s
regexpackage for Python-only features - Uses latest JS RegExp and core-js polyfill for JS-compatible patterns
- Uses Pyodide and Python’s
- Written in modern TypeScript, targeting evergreen browsers
- Zero technical debt: Bun for scripts, Vite for build/test/bundle, ESLint + Prettier for code quality
bun install @syntropiq/pyreximport * as re from '@syntropiq/pyrex';
const result = re.match('a(b+)', 'abbb');
if (result) {
console.log(result.group(1)); // 'bbb'
}- Build:
bun run build - Test:
bun run test - Lint:
bun run lint - Format:
bun run format
src/— TypeScript source codetest/— Unit testsPLAN.md— Architecture and implementation planTODO.md— Task breakdown and progress tracking
Contributions are welcome! Please see PLAN.md and TODO.md for project direction and open tasks.
MIT