$html = preg_replace('/(&?)([^&a-zA-Z0-9\-_\.]page=)[^&]*(&?[^>]*>Go back.*)/i', '$1page=' . $_REQUEST['origPage'] . '$3', $html);
This pattern replacement obliterates the entire value of $html each time I use it.
Consider this:
$html = '
<a href="index.php?section=image&action=edit&sort=&willKeepPageSession=1&page=2">Go back to your previous listing</a>
';
I need to take that predefined value of $html and manipulate the contents so that
&page=2
Becomes
&page=<?= $_REQUEST['origPage'] ?>
Using preg_replace(), however, obliterates all of $html so that it becomes null.
Is there something else I can use then besides preg_replace() to do this precise replacement within the $html HTML string? I obviously can't use preg_replace()!
Thanx
Phil