matchLinkRegex method
Implementation
String matchLinkRegex(String text) {
var regex = RegExp(
r"((https?:www\.)|(https?:\/\/)|(www\.))?[\w\-?=%.][-a-zA-Z0-9@:%.\+~#=]{1,256}\.[a-zA-Z0-9]{1,6}(\/[-a-zA-Z0-9()@:%\+.~#?&\/=]*)?");
if (regex.hasMatch(text)) {
var matchRegex = regex.firstMatch(text)!;
return text.substring(matchRegex.start, matchRegex.end);
} else {
return "";
}
}