tmp.js 344 B

12345678910
  1. let url = "http://localhost:3000/#room=d20a6268d8970c548f87,5ThfXj5qKTlrs1RdGriNVQ?a=47472717032&version=1";
  2. const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)/;
  3. let hash = new URL(url).hash;
  4. console.log(RE_COLLAB_LINK.test(hash));
  5. const match = hash.match(RE_COLLAB_LINK);
  6. console.log(match[1]);
  7. console.log(match[2].length);