Doviren
中文 ▾

Regex101

把正则和样例文本放一起,实时高亮匹配,另有逐步解释面板和多种引擎可选。

它到底是什么怎么用免费档给到哪强在哪、弱在哪适合谁

它到底是什么

原条目说正则「读比写还难」,这个工具就是用来解决读的问题:输入模式、贴一段测试文本,匹配处即时高亮,旁边还有逐步解释。

怎么用

先选对引擎,再写模式、贴样例,看高亮和解释面板逐步核对;改一个字符就能立刻看到差异。

免费档给到哪

原条目写明免费可用,无需安装。

强在哪、弱在哪

调试与教学都很好用;要留意不同引擎语法有差别,在 A 引擎调通不代表在 B 引擎也成立。

适合谁

写新正则、或要读懂别人留下那串正则的开发者。

常见问题

为什么要选引擎?

不同语言的正则语法有差异,原条目支持多引擎分别验证。

能解释别人的正则吗?

能,逐步解释面板就是为这个场景写的。

调完直接贴进代码就行吗?

建议再用目标语言的运行时验一次,避免引擎差异。

关于原文与更新

本页中文部分按中文习惯重写,只转述原条目已有的事实,不新增功能承诺。下面是原站评测全文,一字未删照搬,便于逐条核对;第三方服务的功能与免费额度会变,以英文原条目和对方官网为准。

打开英文完整条目 →

原站评测全文(英文原文,照搬)

Regex101

Regular expressions are notorious for being harder to read than to write. Regex101 fixes that: type a pattern, paste test text, and it highlights matches live while explaining every part of the pattern in plain English.

What It Is

The explanation panel is what sets it apart. Rather than telling you only whether a match occurred, it walks through the pattern token by token — what \d+ does, what a lookahead asserts, why a quantifier is greedy — so you can understand why a pattern behaves the way it does instead of guessing.

It supports multiple engines: PCRE (PHP), JavaScript, Python, Go and others. This matters because regex syntax genuinely differs between languages, and a pattern that works in JavaScript may fail in Go.

Additional features include a debugger that shows the matching steps, a quick-reference library, code generation, and saved patterns if you register.

Open Regex101 →

How To Use It

  1. Go to regex101.com
  2. Select the flavour (engine) that matches your target language.
  3. Type your pattern in the regular expression field.
  4. Paste sample text in the test string area and watch matches highlight live.
  5. Read the explanation panel to understand each part, or open the debugger to see the matching steps.
  6. Copy the generated code snippet for your language when it works.
tip

Free Plan Details

RegistrationNot required (account saves patterns)
WatermarkNone
CostFree
EnginesPCRE, JavaScript, Python, Go, and others
Key featuresLive match highlighting, token-by-token explanation, step debugger, quick reference
ExtrasCode generation, saved patterns, unit tests
ProcessingBrowser-side

Check before you rely on it: free quotas, file limits and pricing change frequently. Confirm current terms on the official site before depending on it for regular work.

Strengths And Limitations

What works well

  • Explanation panel makes opaque patterns comprehensible
  • Multiple engines prevent flavour-mismatch bugs
  • Live highlighting shows exactly what matched
  • Debugger reveals catastrophic backtracking and performance issues
  • Generates ready-to-use code snippets

Limitations

  • Can overwhelm beginners with its number of panels
  • Explanation assumes some regex vocabulary
  • Saved patterns require an account
  • Very complex patterns on huge inputs can be slow

Who Should Use It

Developers writing or debugging patterns, data analysts cleaning text, and anyone who has inherited a regex nobody understands and needs to work out what it does.

Frequently Asked Questions

Is Regex101 free?

Yes, the tester, explanation and debugger are free without registration. An account lets you save patterns.

Which regex engines does it support?

Several, including PCRE, JavaScript, Python and Go — select the one matching your target language.

Why does my regex work here but not in my code?

Almost always an engine mismatch. Select the flavour your language actually uses before testing.

What is the explanation panel?

A breakdown that walks through each token of your pattern in plain language, showing what it matches and why.

Can it help with slow regexes?

Yes, the debugger shows the matching steps and makes excessive backtracking visible.

Can I save my patterns?

Yes, with a free account you can save and share patterns.