Regex: Select strings/lines from one point to another point (with many \n)

I want to select all lines starting with <!-- FLAGS_1 --> and ending with <!-- FLAGS -->

<!-- FLAGS_1 -->
              <div class="cautareField">
                <div align="right">

                  <a href="https://mywebsite.com/pentru-un-zeu.html"><img src="index_files/flag_lang_ro.jpg" title="ro" alt="ro" width="28" height="19" /></a>&nbsp; <a href="https://mywebsite.com/fr/pour-un-dieu.html"><img src="index_files/flag_lang_fr.jpg" title="fr" alt="fr" width="28" height="19" /></a>&nbsp; <a href="https://mywebsite.com/en/love-tender.html"><img src="index_files/flag_lang_en.jpg" title="en" alt="en" width="28" height="19" /></a>&nbsp; <a href="https://mywebsite.com/es/una-oracion-por-un-dios.html"><img src="index_files/flag_lang_es.jpg" title="es" alt="es" width="28" height="19" /></a>&nbsp; <a href="https://mywebsite.com/pt/uma-para-um-deus.html"><img src="index_files/flag_lang_pt.jpg" title="pt" alt="pt" width="28" height="19" /></a>&nbsp; <a href="https://mywebsite.com/ar/love-tender.html"><img src="index_files/flag_lang_ae.jpg" width="28" height="19" title="ar" alt="ar" /></a>&nbsp; <a href="https://mywebsite.com/zh/love-tender.html"><img src="index_files/flag_lang_zh.jpg" width="28" height="19" title="zh" alt="zh" /></a>&nbsp; <a href="https://mywebsite.com/hi/love-tender.html"><img src="index_files/flag_lang_hi.jpg" width="28" height="19" title="hi" alt="hi" /></a>&nbsp; <a href="https://mywebsite.com/de/love-tender.html"><img src="index_files/flag_lang_de.jpg" width="28" height="19" title="de" alt="de" /></a>&nbsp; <a href="https://mywebsite.com/ru/love-tender.html"><img src="index_files/flag_lang_ru.jpg" width="28" height="19" title="ru" alt="ru" /></a>
</div>
</div>
<!-- FLAGS -->

I try many regex combination, but not working:

SEARCH: <!-- FLAGS_1 -->(\s\n.*?)<!-- FLAGS -->


  • Ctrl+F
  • Find what: <!-- FLAGS_1 -->(?:(?!<!-- FLAGS -->).)+<!-- FLAGS -->
  • CHECK Match case
  • CHECK Wrap around
  • CHECK Regular expression
  • CHECK . matches newline
  • Find next

Explanation:

<!-- FLAGS_1 -->        # literally
                    # Tempered Greedy Token
    (?:                     # non capture group
        (?!<!-- FLAGS -->)      # negative lookahead, make sure we haven't <!-- FLAGS --> in the matched string
        .                       # any character
    )+                      # end group, must appear 1 or more times
<!-- FLAGS -->          # literally

try this

  • Ctrl+F
  • Find what: <!-- FLAGS_1 -->[\s\S]*?<!-- FLAGS -->[\s\S]*?