What I'm trying to do is making a valid mail id using regular expressions, from a given string. This is my code:
Pattern pat3 = Pattern.compile("[(a-z)+][(a-z\\d)]+{3,}\\@[(a-z)+]\\.[(a-z)+]");
Matcher mat3 = pat3.matcher("dasdsa@2 @ada. ss2@dad.2om p2@ 2@2.2 fad2@yahoo.com 22@yahoo.com fad@yahoo.com");
System.out.println(mat3.pattern() + " ");
while(mat3.find()){
System.out.println("Position: " + mat3.start() + " ");
}
The problem is nothing is printed out. What I want to print, and what I really expect to print, but it doesn't, is: 39, 67.
Can someone explain me, why \\.
doesn't work? Before putting \\.
my regex was working fine till that point.