Class RegexUtil

java.lang.Object
cloud.opencode.base.string.regex.RegexUtil

public final class RegexUtil extends Object
Regex Utility - Provides regex manipulation helper methods. 正则工具 - 提供正则表达式操作辅助方法。

Features | 主要功能:

  • Pattern compilation with case-insensitive option - 模式编译支持忽略大小写
  • String escaping for regex literals - 正则字面量字符串转义

Usage Examples | 使用示例:

Pattern p = RegexUtil.compile("\\d+");
Pattern ci = RegexUtil.compileIgnoreCase("hello");
String escaped = RegexUtil.escape("a.b"); // "\\Qa.b\\E"

Security | 安全性:

  • Thread-safe: Yes (stateless utility) - 线程安全: 是(无状态工具类)

Performance | 性能特性:

  • Time complexity: O(n) per match where n = input length - 每次匹配 O(n), n为输入长度
  • Space complexity: O(1) with compiled pattern cache - 编译模式缓存 O(1)
Since:
JDK 25, opencode-base-string V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Details