package ccnu;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
public class regex {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String tempHtmlString="粘度为17s,移动距离为350厘米,要求混凝土必须内实外光。振捣时间为30s。";
Pattern p_html;
Matcher m_html;
String regEx = "([^粘度][u4e00-u9fa5]{1,10}(?<=[0-9]))s([^a-z]$)";
p_html = Pattern.compile(regEx);
m_html = p_html.matcher(tempHtmlString);
String resultString="";
try {
resultString = m_html.replaceAll("$1秒");
} catch (PatternSyntaxException ex) {
// Syntax error in the regular expression
} catch (IllegalArgumentException ex) {
// Syntax error in the replacement text (unescaped $ signs?)
} catch (IndexOutOfBoundsException ex) {
// Non-existent backreference used the replacement text
}
System.out.println(resultString);
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有