[R] matching problem

Tom.O tom.olsson at dnbnor.com
Wed Aug 6 15:01:23 CEST 2008


I have a matching problem that I cant solve.
mystring = "xxx{XX}yy{YYY}zzz{Z}" where "x","X","y","Y","z","Z" basiclly can
be anything, letters, digits etc. I'm only interested in the content within
each "{}".

I am close but not really there yet.

library(gsubfn)
strapply(mystring,"\\{[^\\}]+",, perl=F)

gives me
[[1]]
[1] "{XX"  "{YYY" "{Z"  

but what should I add in the code to remove the "{" in the answer

Regards Tom
-- 
View this message in context: http://www.nabble.com/matching-problem-tp18850718p18850718.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list