ahmed19981973

Untitled

May 13th, 2019
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.66 KB | None | 0 0
  1.   public static void main(String[] args) {
  2.           String regex="\b([a-zA-Z-0-9_])+@([a-zA-Z-0-9_\\.]+)+\b";
  3.           StringBuilder domains=new StringBuilder();
  4.           Scanner scanner=new Scanner(System.in);
  5.           Integer lines =Integer.parseInt(scanner.nextLine());
  6.           for (int i = 0; i < lines; i++) {
  7.               String str =scanner.nextLine();
  8.               Matcher match= Pattern.compile(regex).matcher(str);
  9.               if (match.find()){
  10.                   for (int j=match.start();j<=match.end();j++)
  11.                       domains.append(str.charAt(j));
  12.                   domains.append(';');
  13.               }
  14.           }
  15.  
  16.  
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment