$html = preg_replace('/^(.*)(&?chooseAlbum=)[^&">]*(&?album=)/i', '$1$2 ' . $chooseOrigSectionAlbum . '$3' . urlencode($origSectionAlbum), $html);
This is supposed to do a pattern substitution within an HTML string whereby
...&chooseAlbum=1&album=blah...
can become
...&chooseAlbum=1&album=foo...
within $html. However, this only works if I have the following in my preg_replace():
Then it works, the placeholder '$2' exists within $html. However, if I do this, which is the correct way of doing the substitution:
Then the placeholder $2 literally vanishes into thin air!
So in other words you see the placholder $2 only if I add a space after the placeholder, which is entirely wrong for the resulting HTML string, but if you leave it off, you see nothing.
Can someone help, I'm just plain stumped on this one!
Phil