package com.cn.util;
import java.util.regex.Pattern;
/**
* 正则表达式 工具类
*
* @author lifangyu
*/
public class RegexUtil {
/*
* IP地址的匹配标达式 ( // \\d{1,3}) // :\d // 0~9数字,{1,3} // 至少一位,最多三位)
*/
private static String regex_IP = "^(121.15.215.(\\d{1,3}))$";
/*
* 字符串 模糊匹配 :^(.*张三.*name.*)$ ; 等值匹配 ^(张三)$
*/
private static String regex_containStr = "^(.*张三.*name.*)$";
/*
* 字符不包含特定字符串的表达式
*/
private static String regex_notcontainStr = "^(?!.*(转发)).*$";// 不包含特定字符串的表达式
public static void main(String[] args) {
System.out.println(StringMatchRule("这个邮件 是转发的!", regex_notcontainStr));
}
public static boolean StringMatchRule(String souce, String regex) {
boolean result = false;
if (regex != null && souce != null) {
result = Pattern.matches(regex, souce);
}
return result;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有