diff --git a/fake/xml.fake.ts b/fake/xml.fake.ts index 209a987..98bab9d 100644 --- a/fake/xml.fake.ts +++ b/fake/xml.fake.ts @@ -13,7 +13,7 @@ function esc(s: string) { // 从原始 XML 文本中提取某个标签的文本内容(弱解析,仅用于演示) function pickTag(xml: string, tag: string) { // 说明:使用非贪婪匹配并允许标签上带属性;N.B. 未处理命名空间与嵌套同名标签的复杂情形 - const re = new RegExp(`<${tag}(?:\n|\r|\s|>|/)[^>]*>([\s\S]*?)<\/${tag}>`, 'i'); + const re = new RegExp(`<${tag}(?:\n|\r|s|>|/)[^>]*>([sS]*?)`, 'i'); const m = xml.match(re); return m?.[1]?.trim() ?? ''; }