1
0
mirror of https://github.com/go-vikunja/app synced 2024-06-02 18:49:47 +00:00
app-mirror-github/lib/utils/validator.dart

14 lines
478 B
Dart
Raw Normal View History

2018-10-08 14:26:01 +00:00
final RegExp _emailRegex = new 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,}))$');
2022-09-03 15:43:16 +00:00
bool isEmail(String? email) {
return _emailRegex.hasMatch(email ?? '');
2018-10-08 14:26:01 +00:00
}
final RegExp _url = new RegExp(
r'https?:\/\/((([a-zA-Z0-9.\-\_]+)\.[a-zA-Z]+)|(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))(:[0-9]+)?');
2022-09-03 15:43:16 +00:00
bool isUrl(String? url) {
return _url.hasMatch(url ?? '');
2018-10-08 14:26:01 +00:00
}