Hello all, I have what I think is a simple question but I've been unable to solve it. I have the following string:
A[&states=1]:[&rate=2]425, B[&states=3]:[&rate=5]500 I would like to combine the two expressions in the [], so that only one set of [] is present after each letter, so that I have the following string: A:[&states=1,&rate=2]425, B:[&states=3,&rate=5]500 I tried this: > Y <- gsub("\\[&states=.\\]:\\[&",":\\[&states=.,", X) which almost works, except that it replaces the numbers associated with "states" with the period - not retaining the original value as I thought the wildcard character would. Any help is most appreciated! Thanks Rebecca [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.