QBQBCOO 工具箱

正则表达式在线测试工具

在线正则表达式调试和测试,支持高亮匹配文本、分组提取。提供常用正则模式参考,提升开发效率。

//
常用模式:
g: globali: ignore casem: multilines: dotallu: unicode
0 字符
输入内容后点击处理按钮查看结果

关于正则表达式工具

什么是正则表达式?

正则表达式(Regular Expression)是一种用于匹配和处理字符串的强大工具。它使用特定的语法定义搜索模式,可用于验证输入格式、提取特定内容、替换文本等操作。几乎所有主流编程语言都支持正则表达式。

Syntax Reference

SyntaxDescriptionExample
\dDigit\d+ → "123"
\wWord char\w+ → "hello"
\sWhitespace\s → " "
.Any chara.b → "aab"
*Zero or morea* → "" / "aaa"
+One or morea+ → "a" / "aaa"
?Zero or onea? → "" / "a"
{n,m}n to m timesa{2,4} → "aa"~"aaaa"
[abc]Char class[aeiou] → vowel
[^abc]Negated class[^0-9] → non-digit
^Start of line^Hello
$End of lineend$
( )Capture group(\d+)-(\d+)
(?: )Non-capturing(?:ab)+
|Alternationcat|dog