Fix regex

This commit is contained in:
2022-10-11 14:00:26 +02:00
parent ac757fd322
commit 822f97de4d

View File

@@ -1,7 +1,7 @@
import { APIEndPoint, PartyStatus, SelfStatus } from "./PartyContext"; import { APIEndPoint, PartyStatus, SelfStatus } from "./PartyContext";
export const parseURI = (uri: string): APIEndPoint | undefined => { export const parseURI = (uri: string): APIEndPoint | undefined => {
const x = uri.match(/https?:\/\/(?<partyName>.+)\.(?<host>.+)\/(?<token>.+)/); const x = uri.match(/https?:\/\/(?<partyName>\w+)\.(?<host>.+)\/(?<token>.+)/);
if (x === null || x.groups === undefined) return; if (x === null || x.groups === undefined) return;
const partyName = x.groups["partyName"]; const partyName = x.groups["partyName"];
const token = x.groups["token"]; const token = x.groups["token"];