19 lines
470 B
Dart
19 lines
470 B
Dart
///
|
|
/// 正则判断工具
|
|
///
|
|
class RegexpTool {
|
|
//判断手机号
|
|
static bool isPhoneNumber(String input) {
|
|
// 手机号正则表达式
|
|
final RegExp phoneNumberRegExp = RegExp(r'^1[0-9]{10}$');
|
|
return phoneNumberRegExp.hasMatch(input);
|
|
}
|
|
|
|
//判断邮箱
|
|
static bool isEmail(String input) {
|
|
// 邮箱正则表达式
|
|
final RegExp emailRegExp = RegExp(r'^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$');
|
|
return emailRegExp.hasMatch(input);
|
|
}
|
|
}
|