Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这样的代码
<wp:post_name>artifical-sweeteners-ruin-your-health</wp:post_name>
我想把它改成
<wp:post_name></wp:post_name>
删除标签内的所有内容。
搜索
<wp:post_name>[^<>]+</wp:post_name>
并将所有替换为
这假设标签不能嵌套(这使得正则表达式使用起来非常安全)。如果可能存在其他标签,则需要搜索
(?i)<wp:post_name>.*?</wp:post_name>
相反(相同的替换字符串)。<wp:post_name>然而,这可能只适用于最新版本的 Notepad++,它带来了主要的正则表达式引擎大修,而且风险更大,因为如果可能出现嵌套标签,它会弄乱你的文件。
<wp:post_name>