In regular expressions? =. *? Doubt

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

.

(? =) just match a location


when using parentheses, the matching content will be cached, and if you add? =, it will not be cached. It is not usually used. This is called uncaptured metacharacter,. *? This is 0 or more arbitrary characters;

Menu