I have a string like:
www.mydomain.com/product/$ID_PRODUCT$/ID_$ID_PRODUCT$
what I need is replace strings contained between '$' and '$', also deleting the strings delimiters ( which is '$' ) obtaining something like:
www.mydomain.com/product/1234/ID_1234
Thanks,
EDIT: Trying
$new_string = preg_replace('/(\$)(.*)(\$)/s', product->id, $string);
But it does not handle the second expression...
The demo of @stribizhev , given in comments below, worked for me!