explaingit

any86/any-rule

8,661TypeScriptAudience · developerComplexity · 1/5Setup · easy

TLDR

A VS Code extension (and web app) bundling 84 pre-tested regular expressions for common formats like phone numbers, emails, Chinese IDs, and URLs, search by keyword and insert the pattern without writing it yourself.

Mindmap

mindmap
  root((any-rule))
    What it is
      84 regex patterns
      VS Code extension
      Pre-tested library
    Pattern types
      Phone and ID
      Email and URL
      Dates and paths
    Access methods
      Command palette
      Right-click menu
      Inline shortcut
    Other platforms
      Web app
      JetBrains plugin
      CLI tool
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Insert a tested regex for Chinese mobile numbers, national ID cards, or vehicle plates directly from VS Code without memorizing the pattern.

USE CASE 2

Use the web app or command-line tool to browse and copy common regex patterns for email, URL, IP address, or date validation.

USE CASE 3

Search the extension's catalog with a keyword like 'phone' or 'date' from the VS Code command palette and paste the result instantly.

Tech stack

TypeScript

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

Any-rule is a collection of 84 common regular expressions, packaged as a VS Code extension with support for several other tools as well. A regular expression is a pattern that tells a program what a piece of text should look like, such as what a valid phone number, email address, or date format looks like. Writing these patterns correctly is tedious and error-prone, so having a pre-tested library of them saves developers time. The VS Code extension offers three ways to insert a pattern into your code. You can open the command palette with F1 and type a keyword like "phone" or "date" to search the list. You can right-click anywhere in your editor to open the full catalog. Or you can type the shortcut @zz inline while writing code and pick from the dropdown that appears. Once you select a pattern, VS Code inserts it at the cursor. The extension also includes a visual explanation feature. After selecting a pattern, a prompt lets you open a diagram showing how each part of the expression works, powered by the regexper.com tool. This makes the patterns easier to read and verify before using them. Beyond VS Code, the same collection is available as a web app, a JetBrains IDEA plugin, an Alfred Workflow for macOS, a command-line tool, and a uTools plugin. These are maintained by separate contributors rather than the original author. The patterns in the collection cover Chinese-specific formats like national ID card numbers, vehicle license plates (including new-energy plates), Chinese mobile phone numbers per official carrier data, and Chinese company credit codes. It also includes general formats like email addresses, URLs, IP addresses, dates, and file paths for both Windows and Linux systems. New patterns can be contributed via pull request by adding them to the rules file and running the included tests.

Copy-paste prompts

Prompt 1
I need to validate Chinese national ID card numbers in my app. Give me the any-rule regex for that and show me how to use it in a JavaScript validation function.
Prompt 2
Show me the any-rule patterns for email addresses and URLs, and write a TypeScript function that tests a string against both.
Prompt 3
I'm using the any-rule VS Code extension. How do I use the @zz inline shortcut to find and insert a regex while I'm coding?
Open on GitHub → Explain another repo

← any86 on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.