Originally posted by xblue
two problems I can see
1) your pattern is missing the delimiters
2) your pattern will match a sequence of the characters "here i need your help" in $lineCat, which is not what you describe.
no, seriously, could you post where you got so far instead?
smartass... ;-)
well - i have this line of code - but that obviously does not do the job...
$catKey = "sid"; //value changes evey time cos its in a loop
$lineCat = "";
$lineCat = preg_replace("/<a href=\"/gb/view\.aspx\?s=" . $catKey . "#(.*?)\">(.*?)\<\/a><br>\"/i", "['\\2', '\\1', '_self'],", $lineCat);
the second argument in the preg replace statement looks like this - the board strips out one of the slashes each time... ['\2', '\1', '_self']
one of the problems i still have is, that im just not sure WHAT characters to escape (and why) in the preg_replace() pattern.
hope this helps... rock on - sid