✅ Keep-Only Character Filter
📐 工作原理与说明
反向保留:把勾选的字符类(数字 0-9、小写 a-z、大写 A-Z、字母 a-zA-Z、中文 \u4e00-\u9fff、中英文标点、空白 \s)与自定义字符(先转义正则元字符)拼成一个集合,构造否定字符类 [^集合],按 g 或 gi 把不在此集合内的字符全部删除;未选任何保留项时提示请选择要保留的字符。启用自定义正则时改为取出全部命中片段,再按选项决定用换行还是空串连接
Reverse filtering that keeps only the characters or character classes you specify (for example Chinese or digits) and drops everything else from mixed text.
保留选项
📋 结果
请输入文本...
📚 深度解析:仅保留匹配项
💡 常见使用场景
- 反向过滤:只留含目标词的行,删掉其余,聚焦关键内容。
- 白名单抽取:从混合文本保留特定模式(如保留含订单号行)。
- 降噪:在混乱日志里只留关心的信号。
只留含『支付』的行
1000 行文本里设保留「支付」,输出仅 42 行支付相关;与「按条件过滤」的区别是它直接丢弃不匹配行而非仅隐藏。
❓ 常见问题(FAQ)
- 和文本过滤有什么区别?
- 文本过滤多为「显示/排除」,本工具是「仅保留匹配、丢弃其余」,输出即子集,适合直接产出目标清单。
- 多关键词怎么算?
- 可设「任一匹配即保留」或「全部匹配才保留」,按是否需要 AND/OR 语义选择。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Character category | keeping characters by category follows the Unicode general categories | Unicode UAX #44, character database |
| Whitespace handling | whitespace is a separator class whose retention changes later tokenisation | Unicode UAX #29, word boundaries |
| Width compatibility | fullwidth characters equal halfwidth after compatibility normalisation | Unicode UAX #15, normalisation forms |
⚠️ 使用说明与注意事项
- 本工具纯前端运行,数据不会上传到服务器
- 建议在主流浏览器(Chrome/Safari/Firefox/Edge)中使用
- 计算结果仅供参考,请以实际应用场景为准