home / skills / openclaw / skills / regex-writer

regex-writer skill

/skills/lxgicstudios/regex-writer

This skill turns plain English into working regex patterns with explanations and examples to help you build accurate expressions quickly.

npx playbooks add skill openclaw/skills --skill regex-writer

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
760 B
---
name: regex-writer
description: Generate regex patterns from plain English descriptions. Use when the user needs to create regular expressions without memorizing syntax.
---

# Regex Writer

Turn plain English into working regex patterns. Describe what you want to match and get a tested pattern back with explanation and examples.

## Usage

```bash
npx ai-regex "your description here"
```

## Examples

```bash
# Match email addresses
npx ai-regex "match valid email addresses"

# Extract phone numbers
npx ai-regex "US phone numbers with optional country code"

# Get JSON output
npx ai-regex --json "URLs starting with https"
```

## Notes
- Free, open source, MIT licensed
- Built by LXGIC Studios
- GitHub: https://github.com/LXGIC-Studios/ai-regex

Overview

This skill generates regular expressions from plain English descriptions so you can produce tested, ready-to-use patterns without memorizing regex syntax. It returns a working pattern, usage examples, and a short explanation to help validate and adapt the result. The goal is fast, reliable regex creation for validations, extraction, and search tasks.

How this skill works

You describe what you want to match in plain language and the skill converts that description into a regex pattern. It also provides example matches and non-matches, a brief explanation of the pattern components, and optional JSON output for programmatic workflows. Patterns are framed for common regex engines and include notes about anchors or flags where relevant.

When to use it

  • Creating email, phone, URL, or date validators without learning syntax
  • Extracting specific tokens from text (IDs, codes, serials)
  • Rapidly prototyping search or replace patterns for logs and data
  • Generating regex snippets for use in code, editors, or tools
  • Converting descriptive rules into precise match patterns

Best practices

  • Provide clear, concrete examples of what should match and what should not
  • Specify the target regex engine or flags (e.g., PCRE, JavaScript, case-insensitive)
  • Start with simple descriptions and iterate if matches are too broad or narrow
  • Validate generated patterns against real sample data before deployment
  • Use anchors and quantifiers explicitly when exact matches are required

Example use cases

  • Validate user input: emails, phone numbers, postal codes
  • Extract IDs from logs: order numbers, session tokens, invoice codes
  • Scrape structured data from text: dates, prices, URLs
  • Build search filters for code editors or command-line tools
  • Generate test cases: match and non-match examples for QA

FAQ

Can the skill target a specific regex flavor?

Yes. Indicate the target engine or flags in your description and the pattern will include notes or adjustments for that flavor (for example, JavaScript vs PCRE).

How can I be sure the regex won’t produce false positives?

Provide representative positive and negative examples in your prompt. I return example matches and non-matches so you can quickly validate and refine the pattern before use.