mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 17:25:51 +00:00
Update tagProcessor.js
This commit is contained in:
@@ -4,6 +4,12 @@ function extractContentByTag(xmlString, tagName) {
|
||||
return match ? match[1] : null;
|
||||
}
|
||||
|
||||
function extractFullTagBlock(xmlString, tagName) {
|
||||
const regex = new RegExp(`(<${tagName}[^>]*>[\\s\\S]*?<\\/${tagName}>)`);
|
||||
const match = xmlString.match(regex);
|
||||
return match ? match[0] : null;
|
||||
}
|
||||
|
||||
function replaceContentByTag(xmlString, tagName, newContent) {
|
||||
const regex = new RegExp(`(<${tagName}[^>]*>)[\\s\\S]*?(<\\/${tagName}>)`);
|
||||
if (regex.test(xmlString)) {
|
||||
@@ -11,4 +17,5 @@ function replaceContentByTag(xmlString, tagName, newContent) {
|
||||
}
|
||||
return xmlString;
|
||||
}
|
||||
export { extractContentByTag, replaceContentByTag };
|
||||
|
||||
export { extractContentByTag, replaceContentByTag, extractFullTagBlock };
|
||||
|
||||
Reference in New Issue
Block a user