简体   繁体   English

notepad ++复杂的正则表达式

[英]notepad++ complicated regular expression

I have a huge HTML file and I'd like to delete all the parts starting with [sound: and ending with <div style='font-family: Arial; font-size: 15px;'></div> 我有一个很大的HTML文件,我想删除所有以[sound:开头并以<div style='font-family: Arial; font-size: 15px;'></div>结尾的部分<div style='font-family: Arial; font-size: 15px;'></div> <div style='font-family: Arial; font-size: 15px;'></div>

Here is a sample of my document: 这是我的文件样本:

<div class=Answer>
        <div style='font-family: Arial; font-size: 50px;'>你好</div>
        <br />nĭ hăo<br />[sound:pronunciation_zh_你好.mp3]
        <a href='javascript:py.link("ankiplaypronunciation_zh_你好.mp3");' title="pronunciation_zh_你好.mp3" class="replaybutton browserhide">
           <span>
              <svg viewBox="0 0 32 32">
                 <polygon points="11,25 25,16 11,7"/>
                 Replay
              </svg>
           </span>
        </a>
        <span style="display: none;">&#91;sound:pronunciation_zh_你好.mp3&#93;</span><br />
        <div style='color: DarkSlateGray; font-size: 25px;' ></div>
        <br />
        <div style='font-family: Arial; font-size: 15px;'></div>
     </div>

Expected result: 预期结果:

<div class=Answer>
        <div style='font-family: Arial; font-size: 50px;'>你好</div>
        <br />nĭ hăo<br />
     </div>

I tried using regular expressions in Notepad++ but I can't figure out this one, especially because I always get "invalid expression" probably due to the < , / , > caracters. 我尝试在Notepad ++中使用正则表达式,但是我无法弄清楚这一点,尤其是因为总是由于</>字符而得到“无效的表达式”。

Thanks in advance for your help! 在此先感谢您的帮助!

搜索此表达式并将其替换为:

\[sound:.*?<div\s+style='font-family:\s+Arial;\s+font-size:\s+15px;'></div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM