
블로그에 다음으로 시작하는 링크가 많이 있습니다.https://mywebsite.com. 해당 링크를 삭제하고 싶습니다(단, 특정 댓글 섹션의 /story1.html, /story2.html 등 이전).
<!-- FLAGS1 --> <div class="cotarerField"> <div align="right">
<a href="https://mywebsite.com/story1.html"><img src="index_files/flag_lang_ro.jpg" title="ro" alt="ro" width="28" height="19" /></a>
<a href="https://mywebsite.com/fr/story2.html"><img src="index_files/flag_lang_fr.jpg" title="fr" alt="fr" width="28" height="19" /></a>
<a href="https://mywebsite.com/en/story3.html"><img src="index_files/flag_lang_en.jpg" title="en" alt="en" width="28" height="19" /></a>
<a href="https://mywebsite.com/es/story4.html"><img src="index_files/flag_lang_es.jpg" title="es" alt="es" width="28" height="19" /></a>
<a href="https://mywebsite.com/pt/story5.html"><img src="index_files/flag_lang_pt.jpg" title="pt" alt="pt" width="28" height="19" /></a>
<a href="https://mywebsite.com/ar/story6.html"><img src="index_files/flag_lang_ae.jpg" width="28" height="19" title="ar" alt="ar" /></a>
<a href="https://mywebsite.com/zh/story7.html"><img src="index_files/flag_lang_zh.jpg" width="28" height="19" title="zh" alt="zh" /></a>
<a href="https://mywebsite.com/hi/story8.html"><img src="index_files/flag_lang_hi.jpg" width="28" height="19" title="hi" alt="hi" /></a>
<a href="https://mywebsite.com/de/story9.html"><img src="index_files/flag_lang_de.jpg" width="28" height="19" title="de" alt="de" /></a>
<a href="https://mywebsite.com/ru/story10.html"><img src="index_files/flag_lang_ru.jpg" width="28" height="19" title="ru" alt="ru" /></a>
</div>
<!-- FLAGS1 -->
아니면 여기에서 확인하실 수 있습니다 https://pastebin.com/Dtt3KjME
예상 결과(모두 삭제 https://mywebsite.com/
)
<!-- FLAGS1 --> <div class="cotarerField"> <div align="right">
<a href="story1.html"><img src="index_files/flag_lang_ro.jpg" title="ro" alt="ro" width="28" height="19" /></a>
<a href="fr/story2.html"><img src="index_files/flag_lang_fr.jpg" title="fr" alt="fr" width="28" height="19" /></a>
<a href="en/story3.html"><img src="index_files/flag_lang_en.jpg" title="en" alt="en" width="28" height="19" /></a>
<a href="es/story4.html"><img src="index_files/flag_lang_es.jpg" title="es" alt="es" width="28" height="19" /></a>
<a href="pt/story5.html"><img src="index_files/flag_lang_pt.jpg" title="pt" alt="pt" width="28" height="19" /></a>
<a href="ar/story6.html"><img src="index_files/flag_lang_ae.jpg" width="28" height="19" title="ar" alt="ar" /></a>
<a href="zh/story7.html"><img src="index_files/flag_lang_zh.jpg" width="28" height="19" title="zh" alt="zh" /></a>
<a href="hi/story8.html"><img src="index_files/flag_lang_hi.jpg" width="28" height="19" title="hi" alt="hi" /></a>
<a href="de/story9.html"><img src="index_files/flag_lang_de.jpg" width="28" height="19" title="de" alt="de" /></a>
<a href="ru/story10.html"><img src="index_files/flag_lang_ru.jpg" width="28" height="19" title="ru" alt="ru" /></a>
</div>
<!-- FLAGS1 -->
답변1
- Ctrl+H
- 무엇을 찾다:
(?:\A[\s\S]*<!-- FLAGS1 -->|\G)(?:(?!<!-- FLAGS1 -->)[\s\S])+?\Khttps://mywebsite\.com/(?=[\s\S]*<!-- FLAGS1 -->)
- 다음으로 교체:
LEAVE EMPTY
- 둘러보기 확인
- 정규식 확인
- Replace all
설명:
(?: # non capture group
\A # beginning of file
[\s\S]* # 0 or more any character
<!-- FLAGS1 --> # literally
| # OR
\G # restart from last match position
) # end group
(?: # non capture group (Tempered Greedy Token)
(?!<!-- FLAGS1 -->) # negative lookahead, make sure we haven't <!-- FLAGS1 -->
[\s\S] # any character
)+? # end group, appears 1 or more times, not greedy
\K # forget all we have seen until this position
https://mywebsite\.com/ # text to be removed
(?=[\s\S]*<!-- FLAGS1 -->) # positive lookahead, make sure we have <!-- FLAGS1 --> after
주어진:
<a href="https://mywebsite.com/ru/story10.html"><img src="index_files/flag_lang_ru.jpg" width="28" height="19" title="ru" alt="ru" /></a>
<!-- FLAGS1 --> <div class="cotarerField"> <div align="right">
<a href="https://mywebsite.com/story1.html"><img src="index_files/flag_lang_ro.jpg" title="ro" alt="ro" width="28" height="19" /></a>
<a href="https://mywebsite.com/fr/story2.html"><img src="index_files/flag_lang_fr.jpg" title="fr" alt="fr" width="28" height="19" /></a>
</div>
<!-- FLAGS1 -->
<a href="https://mywebsite.com/ru/story10.html"><img src="index_files/flag_lang_ru.jpg" width="28" height="19" title="ru" alt="ru" /></a>
주어진 예에 대한 결과:
<a href="https://mywebsite.com/ru/story10.html"><img src="index_files/flag_lang_ru.jpg" width="28" height="19" title="ru" alt="ru" /></a>
<!-- FLAGS1 --> <div class="cotarerField"> <div align="right">
<a href="story1.html"><img src="index_files/flag_lang_ro.jpg" title="ro" alt="ro" width="28" height="19" /></a>
<a href="fr/story2.html"><img src="index_files/flag_lang_fr.jpg" title="fr" alt="fr" width="28" height="19" /></a>
</div>
<!-- FLAGS1 -->
<a href="https://mywebsite.com/ru/story10.html"><img src="index_files/flag_lang_ru.jpg" width="28" height="19" title="ru" alt="ru" /></a>
화면 캡처(이전):
화면 캡처(이후):