Good afternoon. There is a html type code
... {if var > 0} тут хтмл код {else}тут другой хтмл код {endif} ..... {if id < 6}тут хтмл код{else}тут другой код{endif} ... Trying to find all entries matching the pattern:
!{if ([a-z0-9:]{3,20}) ([\=\=|>|<|\!\=]{1,2}) ([0-9a-z]{1,20})}(.*?){else}(.*?){endif}!U I use (. *?) Because inside the conditions there can be any content (not only html code and text).
The problem is that if the condition is one, it finds everything correctly. But if there are more conditions, the entire piece of code from the first {if to the last endif} is taken.