Merge pull request #138 from matrix-org/leniant-identifiers
Make identifier regexes closer to the spec
This commit is contained in:
commit
ff62521614
1 changed files with 5 additions and 5 deletions
|
@ -16,13 +16,13 @@ import {
|
|||
*/
|
||||
type Verifier<A> = [RegExp, A];
|
||||
export const roomVerifiers: Verifier<LinkKind.Alias | LinkKind.RoomId>[] = [
|
||||
[/^#([^/:]+?):(.+)$/, LinkKind.Alias],
|
||||
[/^!([^/:]+?):(.+)$/, LinkKind.RoomId],
|
||||
[/^#([^:]*):(.+)$/, LinkKind.Alias],
|
||||
[/^!([^:]*):(.+)$/, LinkKind.RoomId],
|
||||
];
|
||||
export const verifiers: Verifier<LinkKind>[] = [
|
||||
[/^[!#]([^/:]+?):(.+?)\/\$([^/:]+?)$/, LinkKind.Permalink],
|
||||
[/^@([^/:]+?):(.+)$/, LinkKind.UserId],
|
||||
[/^\+([^/:]+?):(.+)$/, LinkKind.GroupId],
|
||||
[/^[!#]([^:]*):(.+)\/\$([^:]+):(.+)$/, LinkKind.Permalink],
|
||||
[/^@([^:]+):(.+)$/, LinkKind.UserId],
|
||||
[/^\+([^:]+):(.+)$/, LinkKind.GroupId],
|
||||
...roomVerifiers,
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in a new issue