📄 datavalidator.java
字号:
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -