Reputation: 5994
I'm using the RegExp below to find links in a string. I need to extend it with a check for all domain TLDs (.com, travel, .name, etc).
var str = "check example.com or www.example.com or http://example.com or https://example.com or www.example.travel";
var filter:RegExp = /((https?:\/\/|www\.| |\*)[äöüa-z0-9\-\:\/]{1,}+\.[\*\!\'\(\)\;\:\@\&\=\$\,\?\#\%\[\]\~\-\+\_äöüa-z0-9\/\.]{2,}+)/gi
var matches = str.match(filter)
if (matches !== null) {
trace("Found: " + matches);
} else {
trace("nothing found");
}
I think it needs to be something like this [.com|.travel|.name]
but how to implement it?
Upvotes: 1
Views: 66
Reputation: 5255
I think it's a lot easier to do this in two steps.
Upvotes: 1