Commit 0339cbdd75b67e0817f94bef3cd390fc3c29931c
1 parent
5d114b7c
文字替换符号处理。
Showing
1 changed file
with
2 additions
and
2 deletions
src/main/java/com/xly/util/AdvancedSymbolRemover.java
| @@ -39,10 +39,10 @@ public class AdvancedSymbolRemover { | @@ -39,10 +39,10 @@ public class AdvancedSymbolRemover { | ||
| 39 | 39 | ||
| 40 | // ============================ | 40 | // ============================ |
| 41 | // 🔥 修正版:保留 中文、英文、数字、小数点、负号、空格 | 41 | // 🔥 修正版:保留 中文、英文、数字、小数点、负号、空格 |
| 42 | - // 🔥 额外保留:中文标点 。,、;:?! | 42 | + // 🔥 额外保留:中文标点 。,、;:?!: |
| 43 | // 只删除 * # @ % ^ & 等特殊符号 | 43 | // 只删除 * # @ % ^ & 等特殊符号 |
| 44 | // ============================ | 44 | // ============================ |
| 45 | - text = text.replaceAll("[^a-zA-Z0-9\\u4e00-\\u9fa5\\-. 。,、;:?!]", " "); | 45 | + text = text.replaceAll("[^a-zA-Z0-9\\u4e00-\\u9fa5\\-. 。,、;:?!:]", " "); |
| 46 | 46 | ||
| 47 | // 多余空格变成单个空格(更干净) | 47 | // 多余空格变成单个空格(更干净) |
| 48 | text = text.replaceAll("\\s+", " ").trim(); | 48 | text = text.replaceAll("\\s+", " ").trim(); |