跳到正文Skip to content

正则表达式测试Regex Tester

用示例文本测试 JavaScript 正则,实时高亮匹配并显示分组。Test a JavaScript regular expression on sample text with live highlighting and capture groups.

理念:Idea: 边写边看结果,少走弯路。See results as you type; fewer detours.

解决:Solves: 实时看匹配结果,少走试错See matches live while you write

适合:For: 写正则表达式的人Anyone writing regular expressions

可用Available在浏览器中运行Runs in your browser
Loading tool…

在你的设备上本地处理。这里输入的内容不会上传。Processed locally on your device. Nothing you enter here is uploaded.

使用方法How to use

  1. 1输入表达式并选择标志。Type a pattern and choose flags.
  2. 2粘贴测试文本。Paste test text.
  3. 3查看高亮的匹配和分组。Read the highlighted matches and groups.

说明Good to know

  • 使用浏览器的 JavaScript 正则引擎,个别写法与 PCRE、Python 不同。Uses the browser's JavaScript regex engine; a few features differ from PCRE and Python.
  • 最多显示 1000 处匹配。写得不好的表达式遇到长文本可能很慢,卡住时刷新页面即可。Shows up to 1000 matches. A badly written pattern on long text can be slow; reload the page if it hangs.
  • Base64 编解码Base64 Encoder / Decoder

    文本与 Base64 互转,完整支持 UTF-8 与中文。Encode text to Base64 and decode it back, with full UTF-8 support.

    可用Available开发者工具Developer
  • Hash 计算Hash Generator

    计算文本的 SHA-1、SHA-256、SHA-384、SHA-512 值。Compute SHA-1, SHA-256, SHA-384 and SHA-512 of any text.

    可用Available开发者工具Developer
  • HTML 转义HTML Escape / Unescape

    转义或还原 HTML 里的特殊字符(< > & 引号等)。Escape or unescape special characters in HTML text and attributes.

    可用Available开发者工具Developer