Skip to content
Prev 379931 / 398500 Next

reg expr that retains only bracketed text from strings

strcapture() can help here.
proto=data.frame(InParen=""))
  InParen
1    <NA>
2     (B)
3     (C)

Classic regular expressions don't do so well with nested parentheses.
Perhaps a perl-style RE could do that.
x=c("()", "a(s(d)f)g"))
  InParen
1      ()
2   (d)f)

Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Jun 11, 2019 at 10:46 PM nevil amos <nevil.amos at gmail.com> wrote: