Import java.io. *; import java.util.regex. *;
Public class test {public static void main (string [] args) {try {string s = ""; while (! s.Equals ("q")) {system.out.print ("Input:"); DataInputStream in = New DataInputStream (New BufferedInputStream (System.in)); s = in.ready (); System.out.Println ("Your Input is:" S); string check = "^ ([A-Z0-9A- Z] [- | //.]?) [A-Z0-9A-Z] @ ([A-Z0-9A-Z] (- [A-Z0-9A-Z] )? // .) [A-ZA-Z] {2,} $ "; pattern regex = pattern.compile (check); matcher matcher = regex.matcher (s); boolean ismatched = matcher.matches (); if (ismatched) {System.out.Println ("It's a email");} else {system.out.println ("it's not a email");}}} catch (exception e) {system.out.println ("error" E.getMessage ());}}}