[R] Regular expression

Christofer Bogaso bogaso.christofer at gmail.com
Tue Jan 15 22:38:44 CET 2013


Hello again,

I am having a problem on Regular expression. Let say I have following code:

> gsub("[',]", "", "'asd'f")
[1] "asdf"


This is perfect. However I am having problem if I include "" (i.e. the
double quote) in the first argument as the pattern search:

> gsub("[',"]", "", "'asd'f")
Error: unexpected ']' in "gsub("[',"]"


What is the right way to include the 'double quote' in the search field?

Thanks for your help.



More information about the R-help mailing list