if(!getEmail().matches("^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$"))
{
              errors.add("name",new ActionMessage("email.invalid));
}

Do not FULLY understand the characters starting from '^' ....

the characters starting from [^]
represent a regular expression for checking the validity of and entered email address.

for further reading, just check out regular expressions or pattern matching.

the characters starting from [^]
represent a regular expression for checking the validity of and entered email address.

for further reading, just check out regular expressions or pattern matching.

Maybe i didn't ask properly.. Yes i do know why they are there but could not interpret them .. especially the [\\w\\.-]* ... anyways, will search for pattern matching thanx...

After reading through, my interpretation is a follows

^[a-zA-Z] must start with a letter(s)

[\\w\\.-]* can be followed by  a number of characters including/ending with a dot or hyphen

[a-zA-Z0-9]@ must have a letter(s) and should be followed by '@'

[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9] same as above (a string which may contain a dot or hyphen

\\. a dot must exist 

[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$" a string which may contain a dot but must end with word characters

Have a question, does these dots [\.] within brackets suggests that i can have dots in my address i.e email.address-01@my.own.company.com ?

This article has been dead for over six months. Start a new discussion instead.