Hi there, DaniWeb.
I have been struggling with this one for a while.
How do i write a regexp that matches every {$*} wherein * is wildcard.
I have written one: /\{\$(.*)\}/ and it works fine at regexpal.com, but not with my preg_replace:(
<?php
$string = "Hello {$name}! How are you?";
$pattern = "/\{\$(.*)\}/";
$replace = "${1}";
$newstring = preg_replace($pattern,$replace,$string);
echo $newstring;
?>
However, the output should then be "Hello name! How are you?"
but instead, the output isj ust "Hello {$name}! How are you?"
No errors, just the text without anything replaced. Can anybody please help me?:)
Thank you alot!