Say, there is an array:
array:4 [
0 => "{__}"
1 => "{one|two|three}"
2 => "{__}"
3 => "{red|green|blue}"
]
and text:
> Lorem {__} dolor sit amet, consectetur {one|two|three} elit, sed do
> eiusmod tempor incididunt ut labore et dolore {__} aliqua. Ut enim ad
> minim veniam, quis nostrud exercitation ullamco laboris nisi ut
> aliquip ex ea commodo {one|two|three}. Duis {red|green|blue} irure
> dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
> nulla pariatur.
How to replace all {__} to <input type="text" name="text[n]" />
(n - number of entry) and all {a|b|c|...|N} to
<select name="list[n]">
<option value="1">a</option>
<option value="2">b</option>
<option value="3">c</option>
<option value="4">...</option>
<option value="N">N</option>
</select>
(n - number of entry)