删除字符串外的所有内容,包括字符

时间:2017-11-23 13:55:36

标签: notepad++

我想删除: - 字符串之外的所有内容(例如Links); - 字符串本身;

并且只保留字符串之间的短语。

见下文:

来源数据:

<Word>

结式:

Lorem ipsum dolor sit amet, <Word>consectetur</Word> adipiscing elit. In non porta nulla. Praesent auctor tellus sit amet libero auctor interdum. Morbi pulvinar, lorem vel volutpat scelerisque, orci magna rhoncus est, tempus <Word>sollicitudin</Word> metus ligula vitae eros. Phasellus ultricies blandit <Word>felis nec</Word> malesuada. Nulla quis neque efficitur, suscipit lacus vitae, ornare massa. <Word>Proin</Word> at blandit enim, nec vulputate leo. Aliquam sed nisl in <Word>nibh placerat</Word> fringilla.

1 个答案:

答案 0 :(得分:2)

查找区域: (?s)(?:.*?<Word>(.+?)</Word>)|(?!.+?<Word>).+

替换为区域: (?1\1\r\n)

搜索模式:正则表达式