Class StringMatcher
java.lang.Object
org.miaixz.bus.core.text.placeholder.StringMatcher
字符串模式匹配,使用${XXXXX}作为变量,例如:
pattern: ${name}-${age}-${gender}-${country}-${province}-${city}-${status}
text: "小明-19-男-中国-河南-郑州-已婚"
result: {name=小明, age=19, gender=男, country=中国, province=河南, city=郑州, status=已婚}
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
StringMatcher
构造- Parameters:
pattern- 模式,变量用${XXX}占位
-
-
Method Details
-
match
匹配并提取匹配到的内容- Parameters:
text- 被匹配的文本- Returns:
- 匹配的map,key为变量名,value为匹配到的值
-