use chrome extension matches in javascript [duplicate]

In a Chrome extension you can say on which tab url your extension must be active by editing the manifest.json

"content_scripts": [
      {
        "matches": ["https://*.dynamics.com/*", "http://*/*BC*", "https://*/*BC*"],
        "js": ["./src/content.js"]
      }
    ],

This is working but I need those in javascript to check some history urls.

    var matchesArr =  ["https://*.dynamics.com/*", "http://*/*BC*", "https://*/*BC*"];

    for (let i = 0; i < matchesArr.length; i++) {
        var re = new RegExp(matchesArr[i]);
        if (re.test(url)) {
            return true;
        }
    }
    return false;

But this doesn’t return true.

Tried it in regex online sites but I dont want to change the matchesArr values. Just want to know which regex google uses and get a true?