APP_NEW/lib/Extension/string.dart

8 lines
219 B
Dart
Raw Permalink Normal View History

2025-03-11 21:17:14 +08:00
extension RegexExt on String {
bool validateEmail() => RegExp(
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
.hasMatch(this);
bool validatePhoneNumber() => length == 11;
}