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

Quick Start

Get started instantly with the online playground. It has a live preview, search and replace, and allows you to share your code!

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

Terminal window
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/pomsky-lang/pomsky/releases/latest/download/pomsky-bin-installer.sh | sh

Or download it from the releases page.

Install from source

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

Install the CLI from source with

Terminal window
cargo install pomsky-bin
How to use the CLI

To find out how to use the CLI, run

Terminal window
pomsky --help

To use Pomsky in Visual Studio Code, install the extension and the CLI (see above).

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.