Q:

Get href value in PHP RegExp using specifice attribute

I want to get those link value whose attribute is data-gaevent="people" 
In this case this is first link.   
<a class="clickstream-link" data-clickstream-record-number="0" data-gaaction="people_serp_0" data-gaevent="people" data-galabel="click" href="/name/Raymundo-Mario-J/Santa-Ana-CA/c7z9sd9" itemprop="url" rel="nofollow">  

<a class="clickstream-link" data-clickstream-record-number="0" data-gaaction="people_serp_0" data-gaevent="anyother" data-galabel="click" href="/name/Raymundo-Mario-J/Santa-Ana-CA/c7z9sd9" itemprop="url" rel="nofollow">  

Here is RegExp:
<a.*href="(.*)"

How can I set condition in RegEXP

A:

Presuming data-gaevent is always before the href...
$url = '<a class="clickstream-link" data-clickstream-record-number="0" data-gaaction="people_serp_0" data-gaevent="people" data-galabel="click" href="/name/Raymundo-Mario-J/Santa-Ana-CA/c7z9sd9" itemprop="url" rel="nofollow">';
preg_match('~<a.*?data-gaevent="people".*?\s+href="(.*?)".*~', $url, $link);
echo $link[1];

