E
emzyme20
Hi,
I'm trying to compile a regular expression that will match the domain
part of an email address. The email address has been split into 2
strings, the part before the @ sign and the part after the @ sign.
This regular expression is just working with the part after the @ sign.
The pattern that I have compiled appears to work for all combinations
except for something like:
a.com
b.com
However, the following do get matched:
a.co.uk
b.co.uk
I think the problem I have is because this combination is only a single
character long. The regular expression is truly horrendous, but I'm now
stuck with the way it has been done and need to figure out how to
modify it to accept the combination of "a.com" as a domain part of an
email address.
Can anyone tell me what's causing this problem from the expression
below?
Pattern.compile("^([\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])?\\.)*[\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])\\.[\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])?$");
Many thanks,
Emma
I'm trying to compile a regular expression that will match the domain
part of an email address. The email address has been split into 2
strings, the part before the @ sign and the part after the @ sign.
This regular expression is just working with the part after the @ sign.
The pattern that I have compiled appears to work for all combinations
except for something like:
a.com
b.com
However, the following do get matched:
a.co.uk
b.co.uk
I think the problem I have is because this combination is only a single
character long. The regular expression is truly horrendous, but I'm now
stuck with the way it has been done and need to figure out how to
modify it to accept the combination of "a.com" as a domain part of an
email address.
Can anyone tell me what's causing this problem from the expression
below?
Pattern.compile("^([\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])?\\.)*[\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])\\.[\\*\\w]([\\*\\w\\-]{0,61}[\\*\\w])?$");
Many thanks,
Emma