fork download
  1. pattern_test<-"\\{(?:[^{}]++|(?R))*}"
  2. teststring <- "{the {dog} is {hot}},{the {cat} is {lazy}}"
  3. 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}}"