/*
* IsEmailAddress
*
* Created: Mon Apr 22 04:16:12 2002
* $Revision$
* Modified: $Date$
*
* Author: Jun Inamori
* E-mail: jun@oop-reserch.com
*
* Copyright (c) 1998-2001 Jun Inamori
* 2-24-7 Shinsenri-Kitamachi, Toyonaka ,
* Osaka 560-0081 , Japan.
* All rights reserved.
*
*/
package com.oopreserch.web;
import java.util.regex.*;
/**
* Implementation of {@link FormValueVerifier} interface.
* Returns <i>true</i> for the valid e-mail address.
*
* @author Jun Inamori
*/
public class IsEmailAddress implements FormValueVerifier{
static private final String REGEX="^[a-zA-Z]([a-zA-Z0-9]|\\.|\\-|\\_)*[a-zA-Z0-9]\\@([a-zA-Z0-9])([a-zA-Z0-9]|\\.|\\-|\\_)*\\.([a-zA-Z0-9]|\\.|\\-|\\_)*([a-zA-Z])";
static private final Pattern PATTERN=Pattern.compile(REGEX);
/**
* Returns <i>true</i> for the valid e-mail address.
*
* @param str String to be tested.
* @return <i>true</i> for the valid e-mail address.
*/
public boolean isValidString(String str){
return ((PATTERN.matcher(str)).matches());
}
} //End of : IsEmailAddress