mirror of
https://github.com/versia-pub/server.git
synced 2026-04-28 05:09:16 +02:00
refactor: ♻️ Rewrite build system to fit the monorepo architecture
This commit is contained in:
parent
7de4b573e3
commit
90b6399407
217 changed files with 2143 additions and 1858 deletions
49
packages/kit/regex.ts
Normal file
49
packages/kit/regex.ts
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import {
|
||||
anyOf,
|
||||
caseInsensitive,
|
||||
charIn,
|
||||
createRegExp,
|
||||
digit,
|
||||
exactly,
|
||||
global,
|
||||
letter,
|
||||
maybe,
|
||||
oneOrMore,
|
||||
} from "magic-regexp";
|
||||
|
||||
export const uuid = createRegExp(
|
||||
anyOf(digit, charIn("ABCDEF")).times(8),
|
||||
exactly("-"),
|
||||
anyOf(digit, charIn("ABCDEF")).times(4),
|
||||
exactly("-"),
|
||||
exactly("7"),
|
||||
anyOf(digit, charIn("ABCDEF")).times(3),
|
||||
exactly("-"),
|
||||
anyOf("8", "9", "A", "B").times(1),
|
||||
anyOf(digit, charIn("ABCDEF")).times(3),
|
||||
exactly("-"),
|
||||
anyOf(digit, charIn("ABCDEF")).times(12),
|
||||
[caseInsensitive],
|
||||
);
|
||||
|
||||
export const mention = createRegExp(
|
||||
exactly("@"),
|
||||
oneOrMore(anyOf(letter.lowercase, digit, charIn("-_"))).groupedAs(
|
||||
"username",
|
||||
),
|
||||
maybe(
|
||||
exactly("@"),
|
||||
oneOrMore(anyOf(letter, digit, charIn("_-.:"))).groupedAs("domain"),
|
||||
),
|
||||
[global],
|
||||
);
|
||||
|
||||
export const webfingerMention = createRegExp(
|
||||
exactly("acct:"),
|
||||
oneOrMore(anyOf(letter, digit, charIn("-_"))).groupedAs("username"),
|
||||
maybe(
|
||||
exactly("@"),
|
||||
oneOrMore(anyOf(letter, digit, charIn("_-.:"))).groupedAs("domain"),
|
||||
),
|
||||
[],
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue