I have a list of urls like this:
http://www.mylocal.com
http://v1.mylocal.com
http://v2.mylocal.com
http://www.mylocal2.com
http://www.mylocal3.com
And I want to write a JS that if I define the search string be "*.mylocal.com" , then it will return www.mylocal.com v1.mylocal.com and v2.myloca.com. And if the search string is "www.local.com", then it will return only www.mylocal.com
how should I write it?