Quick Start
Playground
Section titled “Playground”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
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/pomsky-lang/pomsky/releases/latest/download/pomsky-bin-installer.sh | shpowershell -ExecutionPolicy Bypass -c "irm https://github.com/pomsky-lang/pomsky/releases/latest/download/pomsky-bin-installer.ps1 | iex"npm install -g @pomsky-lang/cliyay -S pomsky-binOr 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
cargo install pomsky-binHow to use the CLI
To find out how to use the CLI, run
pomsky --helpVS Code Extension
Section titled “VS Code Extension”To use Pomsky in Visual Studio Code, install the extension and the CLI (see above).
JavaScript plugin
Section titled “JavaScript plugin”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?')Rust macro
Section titled “Rust macro”If you want to write a Pomsky expression directly in your Rust source code, the pomsky-macro got you covered. Run this command:
cargo add pomsky-macroThen you can import and use it with
use pomsky_macro::pomsky;
const MY_REGEX: &str = pomsky!(["great!"] | "great!");Documentation can be found here.