Regex match double curly braces nested
问题 would regex matches while/loop double curly braces contains double curly braces? <?php $str = '<html lang="{{var doc-lang}}"> <head> <title>{{var doc-title}}</div> </head> <body> <div class="container"> <div class="row" {{while products}}> {{var name}} {{var sku}} {{var barcode}} </div {{while end}}> </div> </body> </html>'; Can we get <div class class="row"', [products], {{var name}}, {{ var sku}} and {{var barcode}} from $str ? I only can think of this Reg \<((.*)\{\{while\s+(.*)\}\}(.*)\{\