I'm working on a URL validation using Javascript. Here I tried a regex that satisfies all my needs except one. I want to get the result false when the input is other than ".com". In the current situation it shows true for ".comm".
var a=["https://www.example.com","https://www.example.com/hz/wishlist/ls/3LIMPQXAM4REU?ref_=wl_share","https://www.example.commmmm/hz/wishlist/ls/3LIMPQXAM4REU?ref_=wl_share"];
var re=/^((https):\/\/)?(www.)[a-z0-9]+(\.(com))+(.*)?$/;
a.map(x=>console.log(x+" => "+re.test(x)));