如果包含 " ! @ # $ % ^ & * " 中的任何一个或多个则返回true,否则返回false。
请教了,最好有源码,谢谢
请教了,最好有源码,谢谢
解决方案 »
- redirect ...................
- Couldn't perform the operation prepareStatement: You can't perform any operation
- 文件操作的问题(有关更新)
- jrockit崩溃文件,大家看看能看出什么问题吗?
- 请教如何使用包
- 关于switch语句的问题
- 哪位有SCJD电子参考书:Sun Certified Programmer & Developer for Java 2 Study Guide
- 加密随机
- 不知道是不是高手才能回答的问题?
- 关于JAVA写串口,在UNIX下的问题
- 求一个正则表达式 如何把xml文里的数字节点换成字符节点
- 这个真不会了
public static boolean regex()
{
String str = " ! @ # $ % ^ & * ";
Pattern p = Pattern.compile("!+|@+|#+|\\$+|%+|\\^+|&+|\\*+");
Matcher m = p.matcher(str);
while (m.find())
{
return true;
}
return false; }
String fileName = "!#@.xml";
String regex = "[!@#\\&%\\^&\\*]*";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(fileName);
System.out.println(m.matches());fileName = "!#@.xml";时应该返回true,如果包含任意一个 " ! @ # $ % ^ & * " 就返回true
{
String str = " ! @ # $ % ^ & * ";
Pattern p = Pattern.compile("!+|@+|#+|\\$+|%+|\\^+|&+|\\*+");
Matcher m = p.matcher(str);
while (m.find())
{
return true;
}
return false; }
String fileName = "!#@.xml";
String regex = "[!@#\\&%\\^&\\*]*";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(fileName);
System.out.println(m.matches());受用耶