Regex Tester|正则表达式测试工具
在线测试正则表达式匹配效果,支持多行文本、高亮显示所有匹配结果,并查看匹配次数。
Test your regular expressions online, highlight all matches in multi-line text, and see the total match count.
1. 输入正则与测试文本 · Pattern & Test Text
3. 正则表达式小贴士 · Regex Tips
-
基础匹配 · Basic matching:
\\d表示数字;\\w表示字母、数字或下划线;.表示除换行符外的任意字符(若勾选s标志,则包含换行)。
\\dmatches digits,\\wmatches word characters, and.matches any character except newline (unless thesflag is set). -
数量与边界 · Quantifiers & boundaries:
+表示“一个或多个”,*表示“零个或多个”,?表示“零个或一个”;{m,n}表示出现m到n次。
^匹配行首,$匹配行尾,\\b匹配单词边界。
+means “one or more”,*“zero or more”,?“zero or one”, and{m,n}“betweenmandntimes”.^matches start of line,$end of line, and\\ba word boundary. -
分组与选择 · Grouping & alternation:
使用圆括号()进行分组,使用|表示“或”。例如:(cat|dog)匹配cat或dog。
Use()to group and|for “or”. For example,(cat|dog)matches eithercatordog. -
标志位选择 · Choosing flags:
一般建议勾选g标志以查看所有匹配;需要忽略大小写时勾选i; 处理多行文本时,可尝试勾选m或s观察差异。
For most testing, enablegto find all matches; useito ignore case; and trymorswhen working with multi-line text to see the difference.
说明:本工具仅用于学习、调试与日常文本处理,不会将您的任何文本内容上传到服务器。
Note: This tool is intended for learning, debugging, and everyday text processing. Your input text is not
uploaded to any server.
