Hello I'm trying to do the following:
Say I have an input string like this
{stackoverflow is a {cool|great} website|stackoverflow is the {best|greatest}}. {stackoverflow is for {cool|great} coders|stackoverflow is the {best|greatest} site for coders}
How can I convert it to the following format by using PHP
{stackoverflow is a [cool|great] website~stackoverflow is the [best|greatest]}. {stackoverflow is for [cool|great] coders~stackoverflow is the [best|greatest] site for coders}
I'm playing with preg_replace but I can't find a working solution.
To sum things up: The nested { should be turn into [.
And the | on the first level should turn into ~.
Any ideas?
Regards