From 78f8bfb45d9c49b8894ffc00ba7c804dedddcf1e Mon Sep 17 00:00:00 2001 From: Jorik Schellekens Date: Wed, 23 Sep 2020 11:32:41 +0100 Subject: [PATCH] Make identifier regexes closer to the spec --- src/parser/parser.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/parser/parser.ts b/src/parser/parser.ts index dbb1721..6461b27 100644 --- a/src/parser/parser.ts +++ b/src/parser/parser.ts @@ -16,13 +16,13 @@ import { */ type Verifier = [RegExp, A]; export const roomVerifiers: Verifier[] = [ - [/^#([^/:]+?):(.+)$/, LinkKind.Alias], - [/^!([^/:]+?):(.+)$/, LinkKind.RoomId], + [/^#([^:]*):(.+)$/, LinkKind.Alias], + [/^!([^:]*):(.+)$/, LinkKind.RoomId], ]; export const verifiers: Verifier[] = [ - [/^[!#]([^/:]+?):(.+?)\/\$([^/:]+?)$/, LinkKind.Permalink], - [/^@([^/:]+?):(.+)$/, LinkKind.UserId], - [/^\+([^/:]+?):(.+)$/, LinkKind.GroupId], + [/^[!#]([^:]*):(.+)\/\$([^:]+):(.+)$/, LinkKind.Permalink], + [/^@([^:]+):(.+)$/, LinkKind.UserId], + [/^\+([^:]+):(.+)$/, LinkKind.GroupId], ...roomVerifiers, ];