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 isLegalUrlParameters(String str) {
    String strPattern = "[&=\\s]+";
    Pattern p = Pattern.compile(strPattern);
    Matcher m = p.matcher(str);
    return m.find();
}

From source file:Main.java

public static boolean checkPhoneNumber(String value) {
    String regExp = "^[1]([3][0-9]{1}|59|51|50|58|88|89|82)[0-9]{8}$";
    Pattern p = Pattern.compile(regExp);
    Matcher m = p.matcher(value);
    return m.find();
}

From source file:Main.java

public static boolean isChineseChar(String str) {
    boolean temp = false;
    Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
    Matcher m = p.matcher(str);
    if (m.find()) {
        temp = true;/*from  ww w  . j a v  a2s  .c om*/
    }
    return temp;
}

From source file:Main.java

public static String extractPattern(String string, String pattern) {
    Pattern p = Pattern.compile(pattern);
    Matcher m = p.matcher(string);
    if (!m.find())
        return null;
    return m.toMatchResult().group(1);
}

From source file:Main.java

public static String getNumberFromString(String text) {
    Pattern p = Pattern.compile("(\\d+)");
    Matcher m = p.matcher(text);
    if (m.find()) {
        return (m.group(1));
    }//from   www  .  ja  v  a  2 s .  co  m
    return "";
}

From source file:Main.java

public static boolean isContainChinese(String txt) {
    Pattern p = Pattern.compile("[\\u4e00-\\u9fa5]");
    Matcher m = p.matcher(txt);
    if (m.find()) {
        return true;
    }//from w  ww . java2  s . com
    return false;
}

From source file:Main.java

public static boolean isContainChinese(String str) {

    Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
    Matcher m = p.matcher(str);
    if (m.find()) {
        return true;
    }/*from w  w  w . jav a 2  s  .com*/
    return false;
}

From source file:Main.java

static public Boolean rutValidation(String rut) {
    Pattern p = Pattern.compile(rut_pattern);
    Matcher m = p.matcher(rut);
    while (m.find()) {
        return true;
    }/*w  ww. jav a2 s.c o m*/
    return false;
}

From source file:Main.java

public static String url2Folder(String url) {
    Pattern p = Pattern.compile("android/(.*?)/");
    Matcher m = p.matcher(url);
    if (m.find()) {
        MatchResult mr = m.toMatchResult();
        return mr.group(1);
    } else {// w  w  w . j  a va 2s .com
        return null;
    }
}

From source file:Main.java

public static List<String> collect(String str) {
    List<String> list = new ArrayList<String>();
    Pattern p = Pattern.compile("\\[.+?\\]+");
    Matcher m = p.matcher(str);
    while (m.find())
        list.add(m.group());/*from w  w  w.  ja  v  a 2  s .  c o  m*/
    return list;
}