我有一個用BBEdit編輯的大XML文件。使用正則表達式從另一個集合中刪除一組標籤
在XML文件中,這是舊日記的數字娛樂,是用音符標記的文本。
<note>Example of a note.</note>
但是,有些註釋標記在引用標籤中嵌入了引號。
<note>Example of a note, but <quote>"here is a quotation within the note"</quote></note>
我需要從註釋標記中刪除所有報價實例,同時保留報價標籤的實際內容。因此,例如將成爲:
<note>Example of a note, but "here is a quotation within the note"</note>
我使用GREP中BBEdit中成功刪除其中的一些,但我開始陷入與過去幾行或有之間的文本更復雜的筆記標記獲得兩套不同的標籤。例如:
<note>Example of a note, <quote>"with a quotation"</quote> and a <quote>"second quotation"</quote> along with some text outside of the quotation before the end of the note.</note>
一些報價可以繼續超過10行。在我的正則表達式中使用\ r似乎沒有幫助。
我還應該說引號標籤可以存在於音符標籤之外,這就排除了只發現/?引用並刪除它的可能性。我仍然需要使用文檔中的引號標籤,而不是註釋標籤內。
非常感謝您的幫助。