I would like to replace a string like
title="CONTSTANTWORD fnwif 740933840 j iowej902 ijofiowi CONTSTANTWORD"
with
id="detectLink"
The word CONTSTANTWORD is, surprisingly, constant. The rest,
fnwif 740933840 j iowej902 ijofiowi
is variable.
I found this answer, so I edited the code to this:
$html = preg_replace('title="CONTSTANTWORD (.*) CONTSTANTWORD"','id="detectLink"',$string);
But unfortunately, this doesn't work. Does anyone know what my preg_replace code should look like?
Edit: this is the error I get:
Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash in ..... on line 8