Dear R Users, I am trying to users gsub to remove multiple cases of square brackets and their different contents in a character string. A sample of such a string is shown below. However, I am having great difficulty understanding regexp syntax. Any help is greatly appreciated. Ally "tree STATE_286000 [&lnP=-12708.453945423369] = [&R] ((((((15[&rate=0.009761226401396686]:7.040851727747465,17[&rate=0.011500289631135564]:7.040851727747465)[&rate=0.010986570567484494]:2.257049446900292,(18[&rate=0.009123432243563103]:2.461289418776003,19[&rate=0.00981822432115329]:2.461289418776003)"
[[alternative HTML version deleted]] ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.