Use new more restrictive regex

This commit is contained in:
Eric Bailey
2023-10-23 15:04:46 -05:00
parent 61f88ae2b0
commit ee3d1ff40d
5 changed files with 42 additions and 23 deletions
+5 -2
View File
@@ -1,6 +1,9 @@
export const TAG_REGEX = /(?:^|\s)(#[^\d\s]\S*)(?=\s)?/gi
export const TAG_REGEX =
/(?:^|\s)(#[\p{L}\p{Emoji_Presentation}\p{Emoji_Modifier_Base}\p{Extended_Pictographic}]{1}[\p{L}\p{Emoji_Presentation}\p{Emoji_Modifier_Base}\p{Extended_Pictographic}\d_-]*)/giu
export const LOOSE_TAG_REGEX =
/(?:^|\s)(#[\p{L}\p{Emoji_Presentation}\p{Emoji_Modifier_Base}\p{Extended_Pictographic}]{1}[\p{L}\p{Emoji_Presentation}\p{Emoji_Modifier_Base}\p{Extended_Pictographic}\d_-]*\S*)/giu
export const ENDING_PUNCTUATION_REGEX = /\p{P}+$/gu
export const LEADING_HASH_REGEX = /^#/
export const LEADING_HASH_REGEX = /^#/g
export function sanitize(tagString: string) {
return tagString