15 lines
453 B
Dart
15 lines
453 B
Dart
class RegularExpression {
|
||
bool isPhoneNumber(String input) {
|
||
// 手机号正则表达式,这里简化为11位数字
|
||
final RegExp phoneRegExp = RegExp(r'^\d{11}$');
|
||
return phoneRegExp.hasMatch(input);
|
||
}
|
||
|
||
bool isEmail(String input) {
|
||
// 邮箱正则表达式,这里简化为常见格式
|
||
final RegExp emailRegExp =
|
||
RegExp(r'^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$');
|
||
return emailRegExp.hasMatch(input);
|
||
}
|
||
}
|