How to make a regular expression search in the html document?

There is an html document which lists links to pages describing cars like this:

....
 <div class="about">
the <div>
 <div class="name">
 <a target="_blank" href="/ts/car/0404029689/">
 MINI COOPER S ALL4 COUNTRYMAN </a>
 <span class="new-arrival">new arrival</span>
</div>
 <div class="decription">
<p>
 2019 V., Petrol, 1998 cm<sup>3</sup>, 192.00 HP 
</p>
<span>
 mileage 0 km. </span>
 <p class="full descr">
 2019 V., Petrol, 1998 cm<sup>3</sup>, 192.00 HP, mileage 0км. 
</p>
</div>
 <div class="item-brand">
the <div>
 <a target="_blank" href="/ts/car/0404029689/">
 MINI COOPER S ALL4 COUNTRYMAN </a>
</div>
</div>
 <div class="item-year">
 2019 
</div>
 <div class="item-gasoline">
 Gasoline 
</div>
 <div class="item-model">
 1998 
</div>
 <div class="item-power">
 192.00 HP 
</div>
 <div class="item-mileage">
 0 km 
</div>
 <div class="price">
 2 556 000.01 <span class="iconfont1">w</span> 
</div>
 <div class="to-favorites">
 the <div><ins class="hovered-el new-arrival"><span data-hint="new arrival"><i></i></span></ins></div>
the <div>&nbsp;</div>
 <div class="add-to">
 <a href="#" class="favorite-link-hovered-star el no-added" data-id="31174"><span class="iconfont1" data-hint="add To favourites">k<i></i></span></a>
 <a href="#" class="favorite-link hovered-el star added hidden" data-id="31174"><span class="iconfont1" data-hint="favorites">k<i></i></span></a>
 <script type="text/javascript">
 $.cookie.json = true;
 var favorite_cookie = $.cookie('BITRIX_SM_FAVORITE_ITEM') || [];

 $.each(favorite_cookie, function(i, item){
 $('.single-el-' + item).find('.added').removeClass('hidden');
 $('.single-el-' + item).find('.no-added').addClass('hidden');
});

</script>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="single el single el-27160" id="bx_3966226736_27160">
the <div>
 <div class="image">
<span>
 <a target="_blank" href="/ts/car/0404027925/" class="backsizefix" style="background-image: url('/upload/iblock/52e/52ece292c50237e341d0a678c201a071.jpg')" title=""></a>
</span>
</div>
 <div class="about">
the <div>
 <div class="name">
 <a target="_blank" href="/ts/car/0404027925/">
 MINI COOPER D ALL4 COUNTRYMAN </a>
</div>
 <div class="decription">
<p>
 2019 V., Diesel, 1995 cm<sup>3</sup>, 150.00 HP 
</p>
<span>
 mileage 0 km. </span>
 <p class="full descr">
 2019 V., Diesel, 1995 cm<sup>3</sup>, 150.00 HP, mileage 0км. 
</p>
</div>
 <div class="item-brand">
the <div>
 <a target="_blank" href="/ts/car/0404027925/">
 MINI COOPER D ALL4 COUNTRYMAN </a>
</div>
</div>
 <div class="item-year">
 2019 
</div>
 <div class="item-gasoline">
 Diesel 
</div>
 <div class="item-model">
 1995 
</div>
 <div class="item-power">
 150.00 HP 
</div>
 <div class="item-mileage">
 0 km 
</div>
 <div class="price">
 2 555 180 <span class="iconfont1">w</span> 
</div>
 <div class="to-favorites">
the <div>&nbsp;</div>
the <div>&nbsp;</div>
 <div class="add-to">
 <a href="#" class="favorite-link-hovered-star el no-added" data-id="27160"><span class="iconfont1" data-hint="add To favourites">k<i></i></span></a>
 <a href="#" class="favorite-link hovered-el star added hidden" data-id="27160"><span class="iconfont1" data-hint="favorites">k<i></i></span></a>
 <script type="text/javascript">
 $.cookie.json = true;
 var favorite_cookie = $.cookie('BITRIX_SM_FAVORITE_ITEM') || [];

 $.each(favorite_cookie, function(i, item){
 $('.single-el-' + item).find('.added').removeClass('hidden');
 $('.single-el-' + item).find('.no-added').addClass('hidden');
});

</script>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="single el single el-30614" id="bx_3966226736_30614">
the <div>
 <div class="image">
<span>
 <a target="_blank" href="/ts/car/0101041334/" class="backsizefix" style="background-image: url('/upload/iblock/276/2763baf44e4d49e1b8a7f884fcc23247.jpg')" title=""></a>
</span>
</div>
 <div class="about">
the <div>
 <div class="name">
 <a target="_blank" href="/ts/car/0101041334/">
 MINI COOPER S CABRIO </a>
</div>
 <div class="decription">
<p>
 2019 V., Petrol, 1998 cm<sup>3</sup>, 192.00 HP 
</p>
<span>
 mileage 0 km. </span>
 <p class="full descr">
 2019 V., Petrol, 1998 cm<sup>3</sup>, 192.00 HP, mileage 0км. 
</p>
</div>
 <div class="item-brand">
the <div>
 <a target="_blank" href="/ts/car/0101041334/">
 MINI COOPER S CABRIO </a>
</div>
</div>
 <div class="item-year">
 2019 
</div>
 <div class="item-gasoline">
 Gasoline 
</div>
 <div class="item-model">
 1998 
</div>
 <div class="item-power">
 192.00 HP 
</div>
 <div class="item-mileage">
 0 km 
</div>
 <div class="price">
 2 539 300.02 <span class="iconfont1">w</span> 
</div>
 <div class="to-favorites">
the <div>&nbsp;</div>
the <div>&nbsp;</div>
 <div class="add-to">
 <a href="#" class="favorite-link-hovered-star el no-added" data-id="30614"><span class="iconfont1" data-hint="add To favourites">k<i></i></span></a>
 <a href="#" class="favorite-link hovered-el star added hidden" data-id="30614"><span class="iconfont1" data-hint="favorites">k<i></i></span></a>
 <script type="text/javascript">
 $.cookie.json = true;
 var favorite_cookie = $.cookie('BITRIX_SM_FAVORITE_ITEM') || [];

 $.each(favorite_cookie, function(i, item){
 $('.single-el-' + item).find('.added').removeClass('hidden');
 $('.single-el-' + item).find('.no-added').addClass('hidden');
});

</script>
</div>
</div>
</div>
</div>
</div>
</div>
...


how to write a regular expression correctly, that he took only these links thus:
1. looking for all the blocks that start <div class="about"> and end with </div>
2. in each block looking for the link starting with <a target="_blank" href=" and ending "

Or maybe another way is easier?
March 23rd 20 at 18:50
2 answers
March 23rd 20 at 18:52
symfony dom crawler
I would rather have done so without regexps
What is it like? So. - Izabella.Pouros commented on March 23rd 20 at 18:55
@Izabella.Pouros, I do Not see the code - Margie_Farrell commented on March 23rd 20 at 18:58
March 23rd 20 at 18:54
Use any HTML DOM Parser CSS Selector s, and you will be SSH-W-Shasta.

Find more questions by tags PHP