Matcher Regex kein Matching -MusterJava

Java-Forum
Anonymous
 Matcher Regex kein Matching -Muster

Post by Anonymous »

Ich habe eine Methode erstellt, die ich hofft, @gmail.com in einer SET -Zeichenfolge zu finden, wobei das Testen beispielsweise [email protected] zurückgegeben wird.public final static boolean isGmail(String s) {

Pattern pattern = Pattern.compile("(\\W|^)[\\w.+\\-]*@gmail.com(\\W|$)");
System.out.println(pattern + " pp ");
Matcher m = pattern.matcher(s);
System.out.println(m + " pp ");
boolean b = m.matches();
System.out.println(b + " pp ");
return b;
}
< /code>

} < /p>

Regex Ich bin sehr neu, so dass das Problem sein könnte, das ich akzeptiere.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post