php获取链接href和文本,如果它们包含设置文本

How do i get the herf link and the text from a link like so

    <a herf="google.com">boom</a>

i need the google.com part and the boom text only ?

also how do i filter out the links to make sure i only get the herf for the link with the text boom because the page has links like this

    <a herf="google.com">boom</a>
    <a herf="google.com">boom1</a>
    <a herf="google.com">boom2</a>
    <a herf="google.com">boom3</a>

Didn't understant how do you want to get them, but this will do the job on php http://sandbox.onlinephpfunctions.com/code/3920bf99f02b18bc707d2699a2e37ab25879bb20

EDIT :

<?php
$str = ' <a herf="google.com">boom</a>
    <a herf="google.com">boom1</a>
    <a herf="google2.com">boom</a>
    <a herf="google.com">boom3</a>';


preg_match_all('/\<a\s[href]+\=\"([a-zA-Z0-9\.\-\_\?\=\#\&]+)\"\>boom\</ui',$str,$matches);
var_dump($matches[1]);

Try to use .filter() along with its call back function to achieve your need,

var anchorWithSpecificText = $('a').filter(function(){
  return $(this).text() == "boom";
});

DEMO