Use a global regex for replaceAll

This commit is contained in:
Stefano Pigozzi 2024-10-12 22:39:40 +02:00
parent 56faec702c
commit 54fcaf80b0
No known key found for this signature in database
GPG key ID: 5ADA3868646C3FC0

View file

@ -27,7 +27,7 @@ const CODE_BLOCK_END_REGEX = /```$/;
const INLINE_CODE_REGEX = /`[^`]+`/;
const TWITTER_DOMAIN_REGEX = /(twitter|x)\.com/i;
const TWITTER_MENTION_REGEX = /@[a-zA-Z0-9_]+@(twitter|x)\.com/;
const TWITTER_MENTION_CAPTURE_REGEX = /(@([a-zA-Z0-9_]+)@(twitter|x)\.com)/;
const TWITTER_MENTION_CAPTURE_REGEX = /(@([a-zA-Z0-9_]+)@(twitter|x)\.com)/g;
function createDOM(html, isDocumentFragment) {
const tpl = document.createElement('template');