0

I want to validate an E-Mail Address with a regular expression in Java. The format of the E-Mail Address is

firstname.lastname@company.xx

The E-Mail address don't contains upper case letters or numbers. The only expression I have is this

([a-z]+(?:[.][a-z]+)*)

but that didn't help me. It is important, that the expression looks for the "." between the firstname and lastname.

It would be nice, if someone could help me with this expression.

4

1 回答 1

1

Try this : [a-z]+\.[a-z]+@[a-z]+\.[a-z]{2,3}

String text = "firstname.lastname@company.xx";
Matcher m1 = Pattern.compile("[a-z]+\\.[a-z]+@[a-z]+\\.[a-z]{2,3}").matcher(text);
ArrayList<String> matches = new ArrayList<String>();
m1.find();
System.out.println(m1.group(0));
于 2013-05-08T07:45:24.020 回答