Regex: Find and show only the string between FIRST-PART and SECOND-PART of the text

I have this text, from many other html with the same format and links, only the text is different. I want to extract this part of the text: "the ideal hypostasis of a vast expanse". Basicaly, after find this text with regex, I need to see that words in the search results.

...<br><br>The message that an artist emphasizes in his personal work is &nbsp; <a href="https://mywebsite.com/zh/how-are-you.html">the ideal hypostasis of a vast expanse<img src="ru.jpg"</a> that includes the space between himself and the components of the surrounding world.<en>

So, I made a regex, with this formula FIRST-PART.*?SECOND-PART

FIND: &nbsp; <a href="https://mywebsite.com/zh/how-are-you.html">.*?<img src="ru.jpg"</a>

The problem of my regex, is that the result it show me all the line, but I need to show me only the text: the ideal hypostasis of a vast expanse


Solution 1:

Use the following:

  • Ctrl+H
  • Find what: (?s)(?<=FIRST-PART).*?(?=SECOND-PART)

OR

  • Find what: (?s)(?<=FIRST-PART)\K(.*?)(?=SECOND-PART)|\1

  • CHECK Match case

  • CHECK Wrap around

  • CHECK Regular expression

In your case, FIND HIS:

(?s)(?<=&nbsp; <a href="https://mywebsite.com/zh/how-are-you.html">).*?(?=<img src="ru.jpg"</a>)