import { tokenizeRegex } from "../protocols/core/tokenizer.js"; const tags = /((?<=[\s,\.;])|^)(#\p{L}[\p{L}\d\-_\/]{2,200})/gmiu; export default class Hashtags { static tagsRegEx = tags; public static extract(text: string, t = new Set()) { if (!text) { return t; } for(const tagG of tokenizeRegex(text, tags)) { let tag = tagG[0].trimEnd(); if (/[,\.;#]$/.test(tag)) { tag = tag.substring(0, tag.length-1); } tag = tag.trim(); if (!tag) { continue; } t.add(tag); } return t; } }