Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- public class _08_ExtractEmails {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String input = sc.nextLine();
- Pattern regex = Pattern.compile("\\w+([.-_]+\\w+)*@\\w+([.]\\w+)+");
- Matcher matcher = regex.matcher(input);
- while(matcher.find()){
- System.out.println(matcher.group());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment