Skip to content
You are viewing the next version of this website. See current version

Quick Start

Go to…

Playground

CLI JavaScript Rust

The CLI allows you to compile Pomsky expressions in the command line.

Pre-built binaries are available for Windows, Linux and macOS. Download them from the releases page.

Pomsky is also packaged for some package managers:

Packaging status

This requires that a recent Rust toolchain is installed. Instructions for how to install Rust can be found here.

Install the CLI with

Terminal window
cargo install pomsky-bin

To find out how to use the CLI, run

Terminal window
pomsky --help

Pomsky can be used with the npm module @pomsky-lang/unplugin. This is a compiler plugin, usable with Vite / Rollup / Webpack / ESBuild / ESM.

If you’re using Vite, add it to your config like this:

import { defineConfig } from 'vite'
import pomsky from '@pomsky-lang/unplugin'
export default defineConfig({
plugins: [pomsky()],
})

Then you can import *.pom files from JavaScript/TypeScript:

import myRegex from './myRegex.pom'
myRegex().test('does this string match?')

or declare Pomsky expressions with the built-in pomsky$ macro:

const myRegex = pomsky$(`% [word]{5} %`)
myRegex().test('does this string match?')

If you want to write a Pomsky expression directly in your Rust source code, the pomsky-macro got you covered. Run this command:

Terminal window
cargo add pomsky-macro

Then you can import and use it with

use pomsky_macro::pomsky;
const MY_REGEX: &str = pomsky!(["great!"] | "great!");

Documentation can be found here.