datavalidator.java
来自「java 写的一个新闻发布系统」· Java 代码 · 共 60 行
JAVA
60 行
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . i n j a h i a w e t r u s t . . .////// DataValidator// MJ 08.01.2001////package org.jahia.utils;import org.apache.regexp.RE;import org.apache.regexp.RESyntaxException;import org.jahia.exceptions.JahiaException;/** * Utility class for data validation. * * @author MJ */public class DataValidator{ private static RE emailRE; static { try { emailRE = new RE("^[\\w\\-\\._=\\!#\\*\\+]+@((([\\w\\-]+\\.)+[a-zA-Z]{2,3})|localhost)$"); } catch (RESyntaxException e) { String errorMsg = "RE exception : " + e.getMessage(); JahiaConsole.println( "DataValidator", errorMsg ); } } /** * Checks whether an email address is valid. * * @param email The email address to check. * @return Whether the email is valid. */ public static boolean isValidEmail (String email) { return (email != null && emailRE.match(email)); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?