Regex Builder

Answer a few questions, get the regex — with explanation and live testing. 100% local.

What should it match? Pick a type, tweak the rules
Test it Paste sample text — matches are highlighted live

Regex Builder / 正则生成器

This regex builder takes the scary out of regular expressions: instead of writing complex patterns by hand, you answer plain questions — "numbers, up to 2 decimal places, optional sign" — and get a working regex with a plain-language explanation, plus a live test box to verify it against your own data. 正则生成器:不用手写正则,回答几个问题(比如"数字,最多两位小数,可带正负号")就能得到可用的正则表达式,附白话解释和实时测试框。Everything runs locally in your browser.

What it can build / 支持生成的类型

  • Numbers — digit range, decimals, plus/minus sign 数字(位数/小数/正负号)
  • Email, phone (CN), ID card (CN), URLs — with sensible strictness options 邮箱/手机号/身份证/URL
  • Chinese text, dates, times — delimiters and 12/24-hour options 中文/日期/时间
  • IP addresses, license plates, strong passwords, alnum keys — real-world formats IP/车牌/密码强度/字母数字

Every result shows the full pattern and an explanation of each part, so you can adapt it safely in any language that supports PCRE-style regular expressions (JavaScript, Python, Java, PHP, .NET...).

Builder + tester in one / 生成与测试一体

Below the generated regex is a live test area: paste sample text and matching parts are highlighted instantly, with a match counter. No "is it actually working?" guessing. 生成正则后可直接在下方测试区粘贴文本,命中部分即时高亮并统计数量。

Privacy / 隐私说明

The regex is assembled and tested entirely on your device. Your sample text never leaves the page. 正则的生成与测试都在本地完成,示例文本不会离开页面。

FAQ / 常见问题

Q: Will the generated regex work in my language? / 生成的正则在我的语言里能用吗? — The patterns use common PCRE-compatible syntax and work in JavaScript, Python, Java, PHP, .NET and most editors. Exotic engines (e.g. some DBs) may need small tweaks. 通用 PCRE 语法,主流语言/编辑器都可用。

Q: Is "strong password" regex a security guarantee? / 密码正则等于安全吗? — It enforces a policy (length + character classes), which helps, but real security also needs breach checks and no reuse. 它只是策略校验,不等于绝对安全。

Related tools / 相关工具