[R] Regular expressions: stuck again...

Noia Raindrops noia.raindrops at gmail.com
Fri Aug 24 09:42:24 CEST 2012


Hello,

try this:

x <- c("SELECT [public_tblFiche].[Fichenr], [public_tblArtnr].[Artnr]", "SELECT public_tblFiche.Fichenr, public_tblArtnr.Artnr")

# > The square backets [ and ] should removed
x <- gsub("[][]", "", x)

# > and xxx_xxx.xxx should become \"xxx\".\"xxx\"\".\"xxx\"
x <- gsub("([[:alpha:]]+)_([[:alpha:]]+)\\.([[:alpha:]]+)", "\"\\1\".\"\\2\".\"\\3\"", x)


-- 
Noia Raindrops
noia.raindrops at gmail.com




More information about the R-help mailing list