updated regex replacement to include old text in debug logging

This commit is contained in:
dylan 2025-12-31 00:19:26 +00:00
parent 7740822918
commit 8d2c808c68

View file

@ -114,9 +114,10 @@ export default async function now() {
const matched = regex.test(newNow) const matched = regex.test(newNow)
console.log(`Regex match found: ${matched}`) console.log(`Regex match found: ${matched}`)
newNow = newNow.replace(regex, (match, openTag, closeTag) => { newNow = newNow.replace(regex, (match, openTag, oldText, closeTag) => {
console.log(`DEBUG: Replacing match for ${item.id}`) console.log(`DEBUG: Replacing match for ${item.id}`)
console.log(`Old match: ${match}`) console.log(`Old match: ${match}`)
console.log(`Old text: ${oldText}`)
// replace href in opening tag // replace href in opening tag
const updatedOpenTag = openTag.replace( const updatedOpenTag = openTag.replace(
/href=["'][^"']*["']/, /href=["'][^"']*["']/,