Code:
{if a = b}
{elseif a = c}
{if x = y}
{endif}
{else}
{endif}
{if x = z}
{endif}
Code:
{if zufall a = b}
{elseif zufall a = c}
{if x = y}
{endif}
{else zufall}
{endif zufall}
{if zufall2 x = z}
{endif zufall2}
Ich würde gerne, wenn möglich, ohne regex arbeiten.
Momentan (1 Regex, sonst nur str_replace und Co):
preg_match_all von if zu endif (Gier durch Modifier U unterdrückt)
-
Code:
{if a = b} {elseif a = c} {if x = y} {endif} -
Code:
{if x = z} {endif}
Text "nachladen", bis dass Anzahl if und Anzahl endif identisch
-
Code:
{if a = b} {elseif a = c} {if x = y} {endif} {else} {endif} -
Code:
{if x = z} {endif}
Erstes if und letztes elseif ersetzen
-
Code:
{qwertz a = b} {elseif a = c} {if x = y} {endif} {else} {qwertz} -
Code:
{qwertz x = z} {qwertz}
Alle noch vorhanden if - endif Blöcke auslesen und ersetzen
-
Code:
{qwertz a = b} {elseif a = c} backup {else} {qwertz} -
Code:
{qwertz x = z} {qwertz}
qwertz durch if, bzw. endif ersetzen und "zufall" an alle if, elseif, else oder endif anfügen
Code:
{if zufall a = b}
{elseif zufall a = c}
backup
{else zufall}
{endif zufall}
{if zufall2 x = z}
{endif zufall2}
Code:
{if zufall a = b}
{elseif zufall a = c}
{if x = y}
{endif}
{else zufall}
{endif zufall}
{if zufall2 x = z}
{endif zufall2}
)
Kommentar