( # start of capture group 1 {{ # match an opening (?: [^{{}}]++ # one or more, non backtracking | (?1) # found {{ or }}, so recurse to capture group 1 )* }} # match a closing ) # end of capture group 1