I need a preg_replace() to turn href="http://ex.com/custom.php?QUERY" Code (markup): into: href="http://ex.com/custom.php?ex=1&QUERY" Code (markup): Thanks for any help. Meanwhile I'll be here Regards