Example usage for java.util.regex Pattern matcher

List of usage examples for java.util.regex Pattern matcher

Introduction

In this page you can find the example usage for java.util.regex Pattern matcher.

Prototype

public Matcher matcher(CharSequence input) 

Source Link

Document

Creates a matcher that will match the given input against this pattern.

Usage

From source file:Main.java

protected static boolean isValidEmail(String email) {
    Pattern pattern = EMAIL_ADDRESS;
    return pattern.matcher(email).matches();
}

From source file:Main.java

public static boolean isPassword(String input) {
    String regex = "^[0-9a-zA-Z|,|.|;|~|!|@|@|#|$|%|\\\\^|&|*|(|)|_|+|\\-|=|\\\\\\\\|/|<|>]+$";
    Pattern p = Pattern.compile(regex);
    return p.matcher(input).matches();
}

From source file:Main.java

public static boolean hasNumber(String x) {
    // .replaceAll("\\\\","")
    Pattern p = Pattern.compile("[0-9]");
    return p.matcher(x).find();
}

From source file:Main.java

public static boolean mailAddressVerify(String mailAddress) {
    String emailExp = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
    Pattern p = Pattern.compile(emailExp);
    return p.matcher(mailAddress).matches();
}

From source file:Main.java

public static int indexOf(Pattern pattern, String s) {
    Matcher matcher = pattern.matcher(s);
    return matcher.find() ? matcher.start() : -1;
}

From source file:Main.java

public static boolean isEmail(String email) {
    String str = "^([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)+[\\.][A-Za-z]{2,3}([\\.][A-Za-z]{2})?$";
    Pattern p = Pattern.compile(str);
    Matcher m = p.matcher(email);
    return m.matches();
}

From source file:Main.java

public static boolean isEmail(String params) {
    String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
    Pattern p = Pattern.compile(str);
    Matcher m = p.matcher(params);
    return m.matches();
}

From source file:Main.java

public static boolean isMobileNO(String params) {
    String str = "^((13[0-9])|(15[^4,\\D])|(17[^4,\\D])|(18[0-9]))\\d{8}$";
    Pattern p = Pattern.compile(str);
    Matcher m = p.matcher(params);
    return m.matches();
}

From source file:Main.java

public static boolean isIFSCValid(String ifsc) {
    String regex = "[A-Z|a-z]{4}[0][A-Z|a-z|0-9]{6}$";
    Pattern pattern = Pattern.compile(regex);
    return pattern.matcher(ifsc).matches();
}

From source file:Main.java

public static boolean isEmailOk(String s) {
    String regex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
    Pattern pattern = Pattern.compile(regex);
    return pattern.matcher(s).matches();
}