You need a regular expression for parsing navigation.

The navigation block can change from this:

<a href="/">HOME</a> / Deep 1 </div> 

Before this:

 <div id="bread-crumbs"> <a href="/">HOME</a> / <a href="/deep1">Deep 1</a> / <a href="/deep2">Deep 2</a> / TFXF2X - FDS<34>0C500 (78-12) </div> 

I want to get an extra for the first option

 HOME Deep 1 

Such for the second

 HOME Deep 1 Deep 2 TFXF2X - FDS<34>0C500 (78-12) 

I could figure out this option https://regex101.com/r/J1Lur7/3/ Next, I ask for help - I can not wrap it in

 <div id="bread-crumbs"></div> 

and get the last line

    1 answer 1

    You can certainly use something like https://regex101.com/r/cfR2d9/4

     /<a\s.*?>(.*?)<\/a>|\/\s+([^\n]+)\s+<\/div>/gs 

    but perhaps it is worth looking in the direction of the DOM parsers on php.