export const validTagMatcher = new RegExp(/^[\p{L}\p{N}_]+$/u) // Format user input for api requests, returns an empty string if invalid export function formatTagInput(str: string): string | false { const normal = str.trim().toLowerCase().replaceAll(/\s\s+/g, ' ').replaceAll(' ', '_') if (!validTagMatcher.test(normal)) { return false } return normal } // Format tag label for display in html export function formatTagTextContent(str: string): string { return str.trim().toUpperCase().replace('_', ' ') } // Format tag usage for display in html export function formatTagUsage(num: number): string { return num.toLocaleString() }