I need a regular expression which extract type specifier ( like %d,%s) from a string.
<?
$price = 999.88;
$str = "string";
$string = "this is a %f sample %'-20s,<br> this string is mixed with type specifier like (number:%d's)";
//output 1 :echo sprintf($string,$price,$str,500);
//output 2 should be $string replaced by [#]
?>
output 1
this is a 999.880000 sample --------------string,
this string is mixed with type specifier like (number:500's)
i want to replace all these type specifiers with [#]. how do i write an regular expression for that type specifiers.
what i need is
output 2
this is a [#] sample --------------[#],
this string is mixed with type specifier like (number:[#]'s)