npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

enhexjs

v0.4.0

Published

EnhEx - Enhanced Expression. Write readable patterns, get Regex.

Downloads

426

Readme

EnhEx: Enhanced Expression

Regex, Enhanced for Readability.

EnhEx is a simple, readable language for writing regular expressions. Write patterns like sentences. Get standard Regex output. Use it anywhere — Python, JavaScript, Rust, CLI, browser.


Why EnhEx?

Regex is powerful but painfully unreadable. After a few months, even your own patterns look like alien code.

EnhEx fixes this:

  • Write patterns in a clean, human-readable syntax
  • Compile to standard Regex that works everywhere
  • One core, written in Rust, compiled to WASM or native extension — runs identically in every language

Language Support Status:

  • Rust: ✅ Native
  • Python: ✅ enhex at PyPI with native extension (PyO3)
  • JavaScript: ✅ enhexjs at NPM with WASM (WASM BindGen)

Quick Example

EnhEx Input

start + one_or_more(word_char | dot | dash) + "@" + one_or_more(word_char | dash) + dot + tld() + end

Regex Output

^[\w\.-]+@[\w-]+\.[a-z]{2,10}$

Same logic, but you can actually read the first one.


Installation

Python

pip install enhex

Rust

cargo install enhex-core

JavaScript / TypeScript

npm install enhexjs

CLI (via Python)

pip install enhex
enhex compile "start + one_or_more(digit) + end"
# Output: ^\d+$

Usage

Python

import enhex as ex

# Compile a pattern string
pattern = ex.compile('start + one_or_more(digit) + end')

# Compile from a .enhex file
phone_pattern = ex.compile_file('phone.enhex')

# Use with standard re module
import re
if re.match(pattern, "367812009"):
    print("Valid number!")

JavaScript

import { enhex, compile, compileRegExp } from 'enhexjs';

// or compile('start + one_or_more(digit) + end'):
const pattern = enhex`start + one_or_more(digit) + end`;
const regex = new RegExp(pattern);

if (regex.test('12345')) {
    console.log('Only digits!');
}

// Or automatic RegExp creation:
const re = compileRegExp('start + one_or_more(digit) + end');

if (re.test('12345')) {
    console.log('Only digits!');
}

Rust

use enhex_core::compile;

let pattern = compile("start + one_or_more(digit) + end").unwrap();
let re = regex::Regex::new(&pattern).unwrap();

assert!(re.is_match("12345"));

CLI

# Compile a pattern string
enhex compile 'start + exactly(10, digit) + end'

# Compile a .enhex file
enhex compile phone.enhex

# Show version
enhex version

Syntax

See EnhEx Language Specification for complete syntax.


File Format

EnhEx patterns are stored in .enhex files:

email.enhex:

start + one_or_more(word_char | dot | dash) + "@" + one_or_more(word_char | dash) + "." + tld() + end

Development

Project Structure

enhex/
├── core/          # Rust core engine
├── bindings/
│   ├── python/    # Python package
│   └── js/        # JavaScript/TypeScript package
├── examples/      # Example .enhex patterns
├── vscode/        # VSCode extension (coming soon)
├── playground/    # Web playground (coming soon)
├── SPEC.md        # Full language specification
└── README.md

Roadmap

  • [x] Language specification
  • [x] Rust core engine + WASM
  • [x] Python binding
  • [x] CLI tool
  • [x] JavaScript/TypeScript binding
  • [ ] VSCode extension (syntax highlighting + live preview)
  • [ ] Web playground

Versioning Policy

EnhEx uses a separated versioning for core and each bindings, for example this list maybe current last versions:

core-v0.2
py-v0.5
js-v0.3.1

Rules:

  • Each core version change results in the same type of version increment across all bindings. (core-v0.4 -> core-v0.5: py-v0.6 -> py-v0.7, js-v0.5 -> js-v0.6)
  • Each binding can have a patch or minor version increment (the major version is only changed by the core), and this change has no effect on the core version or other bindings.

The changelog for the core and each binding is available in a separate file; see CHANGELOG.md for an overview.


License

MIT © Mahan Khalili


RegEx, Enhanced.