add string utils
This commit is contained in:
parent
ff1886cec1
commit
80e4657240
16
lib/core/utils/string_utils.dart
Normal file
16
lib/core/utils/string_utils.dart
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
class StringUtils {
|
||||||
|
static bool emailValidation(String email) {
|
||||||
|
return RegExp(
|
||||||
|
r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$')
|
||||||
|
.hasMatch(email);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool phoneValidation(String phone) {
|
||||||
|
return RegExp(r'^(\+62|62|0)8[1-9][0-9]{6,10}$').hasMatch(phone);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool passwordValidation(String password) {
|
||||||
|
return RegExp(r'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*?[\W_])(?=.{8,})')
|
||||||
|
.hasMatch(password);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user