[R] gsub

arun smartpink111 at yahoo.com
Thu Jun 14 17:37:29 CEST 2012


Hi,
Try this:

sub("(I)\\((.*?)\\)","\\2",t1)
[1] "(Ithis) test"

A.K.



----- Original Message -----
From: nalluri pratap <pratap_stat at yahoo.co.in>
To: r-help at 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 at 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.




More information about the R-help mailing list