简体   繁体   中英

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> <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.

Thanks in advance for your help!

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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