ValidateUrl function

bool ValidateUrl(
  1. String value
)

Implementation

bool ValidateUrl(String value) {
  String pattern = r"^((((H|h)(T|t)|(F|f))(T|t)(P|p)((S|s)?))\://)?(www.|[a-zA-Z0-9].)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,6}(\:[0-9]{1,5})*(/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$";
  RegExp regExp = RegExp(pattern);

  return !regExp.hasMatch(value);
}