A TypeScript library providing a Python-like regex interface with automatic backend selection
npm install @syntropiq/pyrexA 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 regex package for Python-only features
- Uses latest JS RegExp and core-js polyfill for JS-compatible patterns
- Written in modern TypeScript, targeting evergreen browsers
- Zero technical debt: Bun for scripts, Vite for build/test/bundle, ESLint + Prettier for code quality
---
``sh`
bun install @syntropiq/pyrex
---
`typescript
import * as re from '@syntropiq/pyrex';
const result = re.match('a(b+)', 'abbb');
if (result) {
console.log(result.group(1)); // 'bbb'
}
`
---
- Build: bun run buildbun run test
- Test: bun run lint
- Lint: bun run format
- 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