使用正则表达式 /https://[a-z]+.com/ 匹配 URL。这个正则表达式使用了基本的匹配规则,其中 https:// 表示匹配字符串 "https://",[a-z]+ 表示匹配一个或多个小写字母,. 表示匹配一个点号,最后 com 表示匹配字符串 "com"。以下是示例代码:
const regex = /https:\/\/[a-z]+\.com/;
const url1 = 'https://merchant.com';
const url2 = 'https://google.com';
console.log(regex.test(url1)); // true
console.log(regex.test(url2)); // false