ask a question about regular expressions. As shown in the following code, I use java to use regular expressions;
public static void test(){
Pattern p=Pattern.compile("(?=.*?[-sharp?!@$%^&*-])");
Matcher m=p.matcher("QQ:456456 :0532214 :aaa123@aaa.com");
while(m.find()) {
System.out.println(m.group());
}
System.out.print("");
}
question 1: why the above code does not match @, does not print out @
my attempt: change to Pattern p=Pattern.compile ("[- sharpware matching matching percent ^ & * -])");
, you can match normally.
question 2: excuse me? =. *? What does it mean? what I understand is "any character begins"
Question 3: can this regular expression contain all the special characters? my requirement now is to check the special characters in the characters .