Hi, text <- "[Swidsinski, Alexander; Loening-Baucke, Vera; Lochs, Herbert] Charite Humboldt Univ, Innere Klin, D-10098 Berlin, Germany; [Hale, Laura P.] Duke Univ, Med Ctr, Dept Pathol, Durham, NC 27710 USA"
gsub("\\[.+?]","",text) A.K. ----- Original Message ----- From: Sabina Arndt <sabina.ar...@hotmail.de> To: r-help@r-project.org Cc: Sent: Tuesday, May 22, 2012 6:08 AM Subject: [R] How to remove square brackets, etc. from address strings? Hello, I'd like to remove the individual pairs of square brackets along with their content - plus the space directly behind it - from address strings such as this: [Swidsinski, Alexander; Loening-Baucke, Vera; Lochs, Herbert] Charite Humboldt Univ, Innere Klin, D-10098 Berlin, Germany; [Hale, Laura P.] Duke Univ, Med Ctr, Dept Pathol, Durham, NC 27710 USA I'd like get the following result: Charite Humboldt Univ, Innere Klin, D-10098 Berlin, Germany; Duke Univ, Med Ctr, Dept Pathol, Durham, NC 27710 USA I tried address = gsub("(.*)[(.*)]", "\\2", address) But this deletes everything from the first opening bracket to the last closing bracket and leaves only the very last address: Duke Univ, Med Ctr, Dept Pathol, Durham, NC 27710 USA How can I remove only the individual pairs of square brackets along with their content? Thank you very much in advance! [[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. ______________________________________________ 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.