Mark, Try this:
> myCharVec [1] "[the rain in spain]" "(the rain in spain)" > gsub("\\[.*\\]", "", myCharVec) [1] "" "(the rain in spain)" You need two backslashes to "escape" the square brackets. The regular expression "\\[.\\]" translates to "a [ followed by 0 or more instances of any character followd by ]". Best regards, Chuck Taylor TIBCO Spotfire Seattle -----Original Message----- I want to eliminate all characters that fall within square brackets as well as the brackets themselves, returning an "". ... #what I want [1] "" "(the rain in spain)" ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.