Example usage for java.util.regex Matcher find

List of usage examples for java.util.regex Matcher find

Introduction

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

Prototype

public boolean find() 

Source Link

Document

Attempts to find the next subsequence of the input sequence that matches the pattern.

Usage

From source file:Main.java

public static boolean existZH(String str) {
    String regEx = "[\\u4e00-\\u9fa5]";
    Pattern p = Pattern.compile(regEx);
    Matcher m = p.matcher(str);
    while (m.find()) {
        return true;
    }/*from ww  w  . j  av  a2s  .co m*/
    return false;
}

From source file:Main.java

public static boolean checkChinese(String username) {
    String pstr = "[^x00-xff]";
    Pattern p = Pattern.compile(pstr);
    Matcher m = p.matcher(username);
    return m.find();
}

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

private static String extractPattern(String string, String pattern) {
    Pattern p = Pattern.compile(pattern);
    Matcher m = p.matcher(string);

    if (!m.find()) {
        return null;
    }//ww w  .  j av a2  s . c o m
    return m.toMatchResult().group(1);
}

From source file:Main.java

public static boolean checkValidPassword(String name) {
    Pattern p = Pattern.compile(pattern_pwd);
    Matcher matcher = p.matcher(name);
    return matcher.find();
}

From source file:Main.java

public static int parseInt(String s) {
    Matcher m = sIntMatcher.reset(s);
    if (!m.find())
        return Integer.MIN_VALUE;
    return Integer.parseInt(m.group(0));
}

From source file:Main.java

public static boolean checkChineseInString(String name) {
    Pattern p = Pattern.compile(pattern_chinese);
    Matcher matcher = p.matcher(name);
    return matcher.find();
}

From source file:Main.java

static public Boolean emailValidation(String email) {
    Pattern p = Pattern.compile(email_pattern);
    Matcher m = p.matcher(email);
    while (m.find()) {
        return true;
    }/* ww  w .  j ava 2s.  c om*/
    return false;
}

From source file:Main.java

public static boolean checkValidName(String name) {
    Pattern p = Pattern.compile(pattern);
    Matcher matcher = p.matcher(name);
    return matcher.find();
}

From source file:Main.java

public static boolean isValidUrl(String input) {
    String URL_REGEX = "^((https?|ftp)://|(www|ftp)\\.)?[a-z0-9-]+(\\.[a-z0-9-]+)+([/?].*)?$";

    Pattern p = Pattern.compile(URL_REGEX);
    Matcher m = p.matcher(input);
    if (m.find()) {
        return true;
    }// w  w w  . j a  va2s  .co m
    return false;
}