$link_text = 'Apply now';
$content = '<td align="right" class="apply"> <a href="http://domain.com?h=AJ&cm=Details_ApplyNow" onClick="ApplyNowClick(\\'A7C6NP\\');" title="Apply for this now!">Apply Now</a></td>';
$pattern = '|<a[^>]+>('.$link_text.')</[^>]+>|U';
preg_match($pattern, $content, $output);
$pattern = '/<[a]{1}(.*)?>(.*)<\\/[a]{1}>/';
$content = trim(preg_replace($pattern, '$1', $output[0]));
... // then parse $content to get the href url
Is it possible to know what is wrong with the regular expression to get the href of this tag?
<td align=“right” class=“apply”> <a href=“http://domain.com?h=AJ&cm=Details_ApplyNow” onClick=“ApplyNowClick(\‘A7C6NP\’);” title=“Apply for this now!”>Apply Now</a></td>
Not getting anything in $output. I’ve this code working for a similar <a …> tag.
Thanks!