package com.example.kl_app.url;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 检测字符串 字母数字中文
*
* 返回为true 符合要求 返回false 不符合要求
*/
public class RegexName {
public static boolean name(String content) {
String regex = "^[a-zA-Z0-9\u4E00-\u9FA5]+$";
Pattern pattern = Pattern.compile(regex);
Matcher match = pattern.matcher(content);
return match.matches();
}
}
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 检测字符串 字母数字中文
*
* 返回为true 符合要求 返回false 不符合要求
*/
public class RegexName {
public static boolean name(String content) {
String regex = "^[a-zA-Z0-9\u4E00-\u9FA5]+$";
Pattern pattern = Pattern.compile(regex);
Matcher match = pattern.matcher(content);
return match.matches();
}
}