跳到主內容

正規表示式測試器

開發者工具

測試正規表示式並高亮比對結果

答案速覽

Regex Tester: Test regular expressions with match highlighting. Regex Tester uses standard developer formulas to compute accurate results instantly.

常用預設:

正規表示式

//g
g=全域 i=忽略大小寫 m=多行 s=點匹配換行

測試文本

匹配數2
首個位置5
標誌g
引擎JavaScript

高亮結果

main 13812345678, backup 19987654321

匹配明細

#匹配內容位置分組
1138123456785—
21998765432125—

語法速查

符號含義
\d \w \sdigit / word / whitespace
.any char except newline
* + ?0+ / 1+ / 0 or 1 times
{n,m}repeat n to m times
[abc] [^abc]set / negated set
^ $ \bstart / end / word boundary
( ) (?: )capture / non-capture group
a|balternation (or)

💡 警惕嵌套量詞(如 (a+)+)導致的災難性回溯,惡意輸入可能讓頁面卡死。儘量寫確定性強、邊界明確的表示式。

這個工具對你有幫助嗎?

怎麼用

  1. Paste or type content: drop code/text into the Regex Tester or fill the parameters.
  2. Choose mode/options: switch format, rules or processing as needed.
  3. Live output: results appear instantly — nothing is submitted, data stays in your browser.
  4. One-click copy: copy the output straight into your development environment.

核心要點

  • Regex Tester is a free online developer tool — open and use, no sign-up.
  • All calculations run locally in your browser; your data never leaves the device.
  • Key capability: Test regular expressions with match highlighting.
  • Results come with formulas and reference tables so you can verify every number.

原理與公式

Regex Tester formula

Regex Tester uses standard developer formulas to compute accurate results instantly.

常見問題

How do I use the Regex Tester?
Open the page and fill in the input fields — results update automatically. Test regular expressions with match highlighting.
Are the results accurate?
Yes. Standard formulas and conversion factors are used and verified.
Is it free? Do I need to sign up?
Completely free. No registration, login or download required.
Does it work on mobile?
Yes. The responsive design works on phones, tablets and desktops.
Is my data saved?
No. Everything runs locally in your browser.

相關工具

相關指南

來源與更新

Based on RFC 4648, ECMA-262 and related specifications. Last updated: 2025-07

最近更新:

本頁公式與內容經YiJianSuan團隊覆核,僅供學習參考,實際業務請以官方口徑為準。

內容由YiJianSuan編輯團隊維護並定期覆核,更新與審核流程詳見編輯規範.

引用本頁: YiJianSuan. 正規表示式測試器[EB/OL]. https://www.yijiansuan.com/zh-TW/c/dev/regex

本工具提供的結果僅供參考,不構成任何專業建議,請以官方核算為準。