关于6位十六进制字符串的正则表达式匹配
2014-08-15 18:47
232 查看
public class RegixTest {
public static void main(String[] args) {
System.out.println(isValidString("0000aa"));
}
public static boolean isValidString(String testString){
String regEx = "[0-9a-fA-F]{6}";
Pattern pat = Pattern.compile(regEx);
Matcher mat = pat.matcher(testString);
if(mat.matches()){
return true;
}else{
return false;
}
}
}
这是一个匹配6位十六进制的正则表达式写法
public static void main(String[] args) {
System.out.println(isValidString("0000aa"));
}
public static boolean isValidString(String testString){
String regEx = "[0-9a-fA-F]{6}";
Pattern pat = Pattern.compile(regEx);
Matcher mat = pat.matcher(testString);
if(mat.matches()){
return true;
}else{
return false;
}
}
}
这是一个匹配6位十六进制的正则表达式写法
相关文章推荐
- 关于利用正则表达式捕获匹配的字符串的简单功能(java)
- 请教一个正则表达式,匹配所有Html标签外部的指定字符串
- 21.2.5 获取与正则表达式进行匹配检测的字符串
- Regex.Match,使用正则表达式匹配字符串
- 正则表达式--匹配字符串
- 【转】关于正则表达式匹配任意字符(包括换行符)的写法
- 获取正则表达式匹配的字符串
- 正则表达式 字符串完全匹配
- MySQL 字符串模式匹配 扩展正则表达式模式匹配
- 正则表达式匹配字符串
- 关于正则表达式匹配任意字符(包括换行符)的写法
- Asp.net的正则表达式,匹配指定的字符和字符串。
- 关于EditPlus正则表达式替换字符串详解
- 关于正则表达式匹配任意字符(包括换行符)的写法
- 贡献一个在匹配字符串前后插入字符的js正则表达式
- java 的正则表达式(Parrent),匹配字符串
- RewriteRule中的正则表达式需要考虑是否要加上^(匹配字符串开头)
- 关于字符串切割和正则表达式的问题
- 使用正则表达式匹配特殊字符串,例一
- 匹配2-5个中文字符串正则表达式.