Hi, Try this: sub("(I)\\((.*?)\\)","\\2",t1) [1] "(Ithis) test"
A.K. ----- Original Message ----- From: nalluri pratap <pratap_s...@yahoo.co.in> To: r-help@r-project.org Cc: Sent: Thursday, June 14, 2012 7:03 AM Subject: [R] gsub Hi, I have a string t1="(Ithis) I(test)". I need to get t2="(Ithis) test". Can someone look into this. ?I have tried using gsub("I[^)]","",t1) , but didn't get the required result. Thanks, Pratap [[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.