You could use the indexOf
method:
url.indexOf('myurl.com')
if the result is greater than -1, then myurl.com
is contained in the url
.
Please try the following demo
var array = ['staging.myurl.com',
'dev.myurl.com',
'qa.myurl.com',
'r1.random.com',
'fake.domain.com'];
// The last two items in the array will not be shwon in the alert.
var desiredUrls = [];
for(var i=0; i<array.length; i++)
if(array[i].indexOf('myurl.com')>-1)
desiredUrls.push(array[i]);
alert(desiredUrls);