My regex allow for now spin syntax {spin1|spin2}
$customContent = preg_replace('/(\{)(.*?)(})/', '{#'.$index.'#}', $customContent, 1);
I would like to allow unlimited nested bracket { {spin1|spin2} {blabla1|blabla2} }
Could you help me to fix this regex please ?
I have tried the below solutions. None worked.
/{([^{}]*)}/
/(?<={)[^}]*(?=})/
/(\{(?:\{.*\}|[^\{])*\})/m
/\{(((?>[^\{\}]+)|(?R))*)\}/x
/\{.*?\}/i