There is for example a structure

<div> text0 <div class="sidebar menu" id="someID"> <div class="warning_block"> <div id="lolID"> <div>Text1</div> <div>Text2</div> </div> <div id="adsfwe"> <a href="bla bla">Hello</a> </div> </div> </div> text4 </div> 

You need to find a div block that has a class or id with different values, such as sidebar, menu, navigation, and which may contain divs nested in it. Tried to make a regular, but it only finds up to the first or second (depending on the code, xs why) closing the div tag

  <div .*?((class)|(id))="((sidebar.*?)|(menu))".*?>(<div.*?>(?1)*?</div>|.)*?</div> 

Please help to make the right expression, or somehow correct it

  • The essence of the question is not clear. Re-write your question. Do you need to find div elements in which there is a class or id ? - Yuri
  • God of parsers will punish you for it :) Take a normal parser and look there. - user207618
  • Yes, you need to find a div tag in which there is a class or id with different values. And at the expense of the god of parsers we will try to agree) - Aronll
  • It is not necessary to negotiate, asking too much dues. Although it has been proven that with the help of regulars any valid HTML can be parsed, but the price is too high (hundreds of regular characters). - user207618
  • one
    Author, specify the language in which the regular expression is required. - ReinRaus

0