Currently im looping through links in a page and checking if the link contains a string to determine the url. Heres my current code:
$( ".domain a" ).each( function () {
if ($(this).is(':contains("imgur")')) {
This can detect if the element contains the string "imgur", but because of this is a link goes to a site like slimgur.com
, it will also return true.
How can I properly check that the url is, in this example, imgur.com
or any of its subdomains (i.imgur.com
& m.imgur.com
) and that a url such as slimgur.com
wont return true?