1

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

1 Answer 1

2

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

3
  • 1
    work. for future interests, your solution here: regex101.com/r/Qw55c3/1
    – SL5net
    Commented Dec 31, 2021 at 14:58
  • nope, is no very good, because if I search in ALL FILES (in a folder with many html files) I will not get as the result only that text between FIRST-PART and SECOND-PART...
    – Just Me
    Commented Dec 31, 2021 at 15:44
  • Maybe @Toto has another better idea :)
    – Just Me
    Commented Jan 2, 2022 at 11:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .