正则表达式测试器
测试正则表达式,支持匹配高亮、捕获组和替换预览。免费、隐私本地化、100% 客户端运行。支持全局(g)、忽略大小写(i)、多行(m)、dotAll(s)标志位,匹配在带超时的 Web Worker 中运行以避免灾难性回溯冻结页面。
尝试示例:
Local only
最近历史
暂无历史
使用方法
- 输入正则表达式模式。
- 将测试文本粘贴到输入框中。
- 切换标志位并查看匹配结果与捕获组。
使用此工具的任务
Analyze SQL 查询执行计划s
EXPLAIN shows 如何数据库 executes 查询. Learn 到读取 plans, 识别瓶颈, 和优化. 任务
计算 edit distance (Levenshtein)
Edit 距离 measures 最小值数字的 insertions, deletions, 和 substitutions 到转换 one 字符串为 另一个. Used 在 spell checking 和 fuzzy matching. 任务
计算 Levenshtein distance
Levenshtein 距离 measures 最小值 edits (插入, delete, substitute) 到转换 one 字符串为 另一个. Used 在 spell checking 和 fuzzy matching. 任务
计算 TF-IDF for text importance
TF-IDF (Term Frequency-Inverse Document Frequency) measures 字 importance 在 document relative 到 corpus. Used 在搜索和 文本 mining. 任务
Debug regex patterns 步骤通过步骤
Debug regex 通过 testing 针对样本输入, visualizing 匹配, 和 understanding 为什么模式 matches 或 fails. Use flags 正确. 任务
提取 all URLs from a block of text
Find 每个 URL (http, https, ftp) 在 unstructured 文本和 列表它们为 validation, deduplication, 或批量过程. 任务
提取 hashtags from text
Hashtags 启动具有 # followed 通过 letters, numbers, 和 underscores. Learn 到提取, 验证, 和 normalize hashtags 从 social media 文本. 任务
提取 @mentions from text
Mentions 启动具有 @ followed 通过 username. Learn 到提取 mentions, 验证 usernames, 和 link 它们到 用户 profiles. 任务
Find 和替换文本 using regular 表达式
Search 为 patterns (不仅 字面量 strings) 在文本和 替换 matches 具有模板该 能够参考 capture groups. 任务
格式化 and beautify SQL statements
SQL formatting improves readability 和 maintainability. Learn indentation rules, keyword alignment, 和 consistent 风格为 复杂 queries. 任务
Design 数据库 indexes 为性能
Indexes 速度上 reads 但慢 下 writes. Learn B-树, hash, composite, 和部分 indexes, 和当 到 use 每个. 任务
Optimize regex 为性能
慢 regex 能够原因 ReDoS (Regular Expression Denial 的 Service). Learn 到识别和 fix catastrophic backtracking, use atomic groups, 和 anchor patterns. 任务
Optimize 慢 SQL queries
Identify 和 fix 慢 SQL queries using EXPLAIN 分析, 索引优化, 和查询 rewriting techniques. 任务
移除 stop words from text
Stop words 是常见 words (, 是, 在, 哪个) 该添加小 meaning. Removing 它们 improves 搜索和 NLP 效率. 任务
发布前测试正则表达式
验证模式语法,检查每个匹配及其捕获组,并了解把正则变成宕机的回溯陷阱。 任务
Tokenize 文本为 NLP 过程
Tokenization splits 文本为 tokens (words, sentences, subwords). Learn 字, sentence, 和 subword tokenization 为 NLP 任务. 任务
Implement 完整-文本搜索在 SQL
完整-文本搜索 indexes words 在文本为 快 searching. Learn 到 use FULLTEXT indexes, tsvector, 和 ranking. 任务
Use regex backreferences
Backreferences \1, \2,。.. 匹配相同文本 as 前一个 capturing 组. Useful 为 matching repeated words, paired delimiters, 和 palindromes. 任务
Use regex 字符 classes 有效
字符 classes [...] 匹配任何 one 字符从 集合. Learn ranges, negation, shorthand classes, 和 escaping rules. 任务
Use regex capturing 和 non-capturing groups
Groups (...) capture submatches 为 backreferences 和 extraction. Non-capturing (?:...) 组无 capturing. Named groups (?<name>...) improve readability. 任务
Use regex lookahead assertions
Lookahead (?=...) 和 (?!...) assert 什么 follows (或 doesn't follow) 当前位置无 consuming characters. Zero-宽度 assertions. 任务
Use regex lookbehind assertions
Lookbehind (?<=...) 和 (?<!...) assert 什么 precedes 当前位置. Supported 在现代 engines (ES2018+, Java,。NET, PCRE). 任务
Use regex quantifiers: *, +, ?, {n,m}
Quantifiers 指定如何许多 times 模式 repeats. Learn greedy, lazy, 和 possessive matching 到 avoid catastrophic backtracking. 任务
验证 SQL syntax before execution
验证 SQL queries for syntax errors before sending to the database. Catch typos, missing keywords, and structural issues early. 任务
Write robust email validation regex
Email validation regex 是 notoriously 复杂由于 RFC 5322. Learn practical patterns 为常见用例和 其 limitations. 任务
Write phone 数字 validation regex
Phone numbers 变化 wildly 通过 country. Learn practical regex patterns 为常见 formats 和为什么 phone 库是 经常 better. 任务
Write URL validation regex
URL validation regex 必须处理协议, 域, 端口, 路径, 查询, 和片段. Learn practical patterns 和当 到 use URL parser instead. 任务
常见问题
- 遇到灾难性回溯会怎样?
- 匹配在带超时的 Web Worker 中运行。若超时,工具会报告超时而非冻结页面。这能防范 (a+)+ 等模式对恶意输入的回溯爆炸。
- 支持哪些标志位?
- 全局(g)、忽略大小写(i)、多行(m)和 dotAll(s)可独立切换。unicode(u)标志默认启用以正确处理代理对。
- 捕获组如何显示?
- 每个匹配列出完整匹配文本和编号捕获组。命名组((?<name>...))会显示其名称。
- 可以预览替换吗?
- 可以。输入替换字符串(含 $1、$2、$& 引用),工具会并排显示替换后的输出与原文,并高亮差异。
- 使用哪种正则流派?
- 工具使用 JavaScript RegExp 引擎(ECMAScript)。现代浏览器支持后行断言 (?<=...) 和 (?<!...)。不支持 POSIX 字符类和 PCRE 特有功能。
- 我的输入会被上传到任何地方吗?
- 不会。所有匹配在 Web Worker 中本地完成。你的模式和测试文本绝不离开浏览器。
相关工具
正则表达式替换器
使用正则表达式查找并替换文本。免费、隐私本地化、100% 客户端运行。 工具
正则解释器
Regex Explain — 纯客户端工具。隐私优先,无服务器往返。 工具
正则可视化器
将正则渲染为 Thompson NFA 状态图(Graphviz DOT 格式)——ε 边、分支与量词回环一目了然,可粘贴到任意 graphviz 渲染器出图。 工具
大小写转换器
在 UPPER、lower、Title、camelCase、PascalCase、snake_case、kebab-case、CONSTANT_CASE 和 Sentence case 等格式之间转换文本。免费、隐私本地化、100% 客户端运行。自动识别混合输入(如 hello_worldFoo),按空格/下划线/连字符/大写边界拆分,适合变量命名、API 字段、CSS 类名和常量定义的格式转换。 工具
字数统计器
统计字符、单词、行、句子、段落数、字节大小,并估算阅读时间。免费、隐私本地化、100% 客户端运行。支持中英文混排统计,句子按 .!? 及全角对应符号拆分,段落按空行分隔,适合写作、博客、论文和文档的字数控制。 工具