[R] Regular expression

arun smartpink111 at yahoo.com
Tue Jan 15 22:52:12 CET 2013

#[1] "asdf"
#[1] "asdf"

----- Original Message -----
From: Christofer Bogaso <bogaso.christofer at gmail.com>
To: r-help <r-help at r-project.org>
Sent: Tuesday, January 15, 2013 4:38 PM
Subject: [R] Regular expression

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.

R-help at r-project.org mailing list
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