fork download
pattern_test<-"\\{(?:[^{}]++|(?R))*}"
teststring <- "{the {dog} is {hot}},{the {cat} is {lazy}}"
unlist(regmatches(teststring, gregexpr(pattern_test, teststring, perl=TRUE)))
Success #stdin #stdout 0.22s 39272KB
stdin
Standard input is empty
stdout
[1] "{the {dog} is {hot}}"  "{the {cat} is {lazy}}"