Closed mandrewstuart closed 4 years ago
Hey, I've updated the library to support custom parsers. Feel free to write an option in LinkifyOptions
for loose URLs which can switch the regex.
Hey Cretezy!
Thanks so much for making this library open. I have been really busy and I haven't made any improvements on this lately but I found a better regex that I would like to share with you and anyone who comes across this thread:
^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S)?@)?(?:(?!(?:10|127)(?:.\d{1,3}){3})(?!(?:169.254|192.168)(?:.\d{1,3}){2})(?!172.(?:1[6-9]|2\d|3[0-1])(?:.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff].)+(?:[a-z\u00a1-\uffff]{2,}.?))(?::\d{2,5})?(?:[/?#]\S)
It's based on https://gist.github.com/dperini/729294 but with adjustments for Dart and optional protocols.
This has been added with v2.1.0.
I am using your library and it's great. I hope this helps make it just a little better
taken from here https://stackoverflow.com/a/56056825