php - preg_replace between [{ and }] -


i have string :

$string='my string [{text_001}] string [{text_002}] ';

i replace preg_replace [{something}] $something (ex : [{text_001}] -> $text_001).

i have error in preg_replace :

$string = preg_replace('/([{.+?)+(}])/i', "$1", $string);

$string = preg_replace('~\[\{(.+?)\}\]~', "\$$1", $string); # string $text_001 string $text_002 

explanation example.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -