0.1.0 • Published 11 months ago
@syntropiq/pyrex v0.1.0
Pythonic Regex API in TypeScript
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.
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
Installation
bun install @syntropiq/pyrexUsage
import * as re from '@syntropiq/pyrex';
const result = re.match('a(b+)', 'abbb');
if (result) {
console.log(result.group(1)); // 'bbb'
}Development
- Build:
bun run build - Test:
bun run test - Lint:
bun run lint - Format:
bun run format
Project Structure
src/— TypeScript source codetest/— Unit testsPLAN.md— Architecture and implementation planTODO.md— Task breakdown and progress tracking
Contributing
Contributions are welcome! Please see PLAN.md and TODO.md for project direction and open tasks.
License
MIT
0.1.0
11 months ago