@Hellena-Crainicu I was puzzled by your comment. I suspect you were testing by having the expression you were testing with at the top of the file. In that case the first title was in the expression itself.
I modified my search expression slightly to replace < with \x3c so that we can have the search/replace expression within the file for testing. I put it at the bottom in these examples.
Here is the test I ran:
Original data
<p>但是减脂期可不一定就意味着每天只吃水煮鸡胸和水煮西蓝花,完全苦行僧一样的生活。如果在营养均衡的三餐之间适当的尝试一些健康的小零食,不仅能为减脂期提供动力和新鲜感,还可以为生活增添不少的趣味呢。</p>除此之外,从营养学角度,适当的加餐可以预防三餐之间出现低血糖的现象,还能防止因为饥饿而在下一餐中暴饮暴食,摄入过多热量的情况发生。</p>因此,健康的小零食不仅有助于完成减脂目标,还能让你的减肥期丰富多彩,何乐而不为呢?下面就来推荐给大家10种好吃又健康的小零食。</p>
<title>用正确方式打开 MyGainer增健肌粉! - MYPROTEIN™</title>
blah bhla
blah bhla
<title>Home is me</title>
blah bhla
<title>Payton is your name</title>
Search: (?s)(\x3ctitle>.*?\x3c/title>.*?)\x3ctitle>.*?\x3c/title>
Replace: $1
###First pass
This is after doing search-replace-all one time. It removed the second title that was on line 5.
<p>但是减脂期可不一定就意味着每天只吃水煮鸡胸和水煮西蓝花,完全苦行僧一样的生活。如果在营养均衡的三餐之间适当的尝试一些健康的小零食,不仅能为减脂期提供动力和新鲜感,还可以为生活增添不少的趣味呢。</p>除此之外,从营养学角度,适当的加餐可以预防三餐之间出现低血糖的现象,还能防止因为饥饿而在下一餐中暴饮暴食,摄入过多热量的情况发生。</p>因此,健康的小零食不仅有助于完成减脂目标,还能让你的减肥期丰富多彩,何乐而不为呢?下面就来推荐给大家10种好吃又健康的小零食。</p>
<title>用正确方式打开 MyGainer增健肌粉! - MYPROTEIN™</title>
blah bhla
blah bhla
blah bhla
<title>Payton is your name</title>
Search: (?s)(\x3ctitle>.*?\x3c/title>.*?)\x3ctitle>.*?\x3c/title>
Replace: $1
###Second pass
This is after doing search-replace-all twice. The first pass removed second title that was on line 5 and the second pass removed the third title that was on line 7.
<p>但是减脂期可不一定就意味着每天只吃水煮鸡胸和水煮西蓝花,完全苦行僧一样的生活。如果在营养均衡的三餐之间适当的尝试一些健康的小零食,不仅能为减脂期提供动力和新鲜感,还可以为生活增添不少的趣味呢。</p>除此之外,从营养学角度,适当的加餐可以预防三餐之间出现低血糖的现象,还能防止因为饥饿而在下一餐中暴饮暴食,摄入过多热量的情况发生。</p>因此,健康的小零食不仅有助于完成减脂目标,还能让你的减肥期丰富多彩,何乐而不为呢?下面就来推荐给大家10种好吃又健康的小零食。</p>
<title>用正确方式打开 MyGainer增健肌粉! - MYPROTEIN™</title>
blah bhla
blah bhla
blah bhla
Search: (?s)(\x3ctitle>.*?\x3c/title>.*?)\x3ctitle>.*?\x3c/title>
Replace: $1
If you watch the status line at the bottom of the search/replace box you will see:
After pass 1: Replace All: 1 occurrence was replaced in entire file
After pass 2: Replace All: 1 occurrence was replaced in entire file
After pass 3: Replace All: 0 occurrences were replaced in entire file
While your examples had the titles on their own lines I had coded to allow them to be anywhere in a line and for them to span lines as that’s what HTML allows. If you want to only support titles on a line by itself then we can add some anchoring:
Search: (?s)^(\x3ctitle>.*?\x3c/title>\R.*?\R)\x3ctitle>.*?\x3c/title>$
Replace: $1
Even that is not perfect as it allows titles to span or more lines. If you insists on only matching titles on one line and not to span them then toggle the dot/EOL spanner flag:
Search: ^(\x3ctitle>(?-s).*?\x3c/title>\R(?s).*?\R)\x3ctitle>(?-s).*?\x3c/title>$
Replace: $1
As you can see, the expression is getting more complicated to deal with the edge cases and requirements.