I have a string:
$str = '{:de}Hallo Welt{:}{:en}Helo world{:}';
now i need to get substring for setted language.
$placeholder = '{:en}';
$lang_content = preg_replace('/(.*)'.preg_quote($placeholder).'(.*)'.preg_quote('{:}').'(.*)/sm', '\2', $str);
in case of value for placeholder {:en}
i get Helo world
as value for $lang_content
, it works fine, but in case {:de}
i get Hallo Welt{:}{:en}Helo world
.
How can it be fixed? thanx!