Forum Moderators: coopster
<a id='user_link' class='' href="http://mysite.com/forums_real_path/index.php?showuser=1" title='Your Profile'Username <span id='user_link_dd'></span></a> $pattern='/<\s*A\s*HREF=(\'|")(.*?)forums_real_path(.*?)(\'|")\s*>(.*?)<\/A>/i';
$replacement='<a href=$1$2forums$3$4>$5</a>';
$final_string=preg_replace($pattern,$replacement,$string); ';
echo "Link\tAnchor\n";
foreach($dom->getElementsByTagName('a') as $link)
{
$href = $link->getAttribute('href');
$anchor = $link->nodeValue;
echo $href,"\t",$anchor,"\n";
// Do something here
}
echo '';
(.*) ONLY when the very next thing is a $ "end" anchor, or when it is the ONLY thing in the pattern. Never use (.*) at the start or in the middle of a pattern. .* if it is the ONLY thing in the RegEx pattern and the value is NOT being captured for re-use. Never use .* at the start or in the middle of a pattern. [edited by: g1smd at 1:21 pm (utc) on Jul 4, 2011]
<script type="text/javascript">
var FAVE_TEMPLATE = new Template( "<h3>Unfollow this forum</h3><div class='ipsPad'><span class='desc'>If you unfollow this forum this you will no longer receive any notifications</span><br /><p class='ipsForm_center'><input type='button' value='Unfollow this forum' class='input_submit _funset' /></p></div>");
</script> <script type="text/javascript">
var FAVE_TEMPLATE = new Template( "<h3>Unfollow this forum<div class='ipsPad'><span class='desc'>If you unfollow this forum this you will no longer receive any notifications<br /><p class='ipsForm_center'><input type='button' value='Unfollow this forum' class='input_submit _funset' /></script></div>");