Skip to content
Prev 273463 / 398506 Next

help with regexp

On Wed, Oct 5, 2011 at 7:56 AM, Jannis <bt_jannis at yahoo.de> wrote:
Here are a couple of solutions:

# remove everything up to _b as well as everything from . onwards
gsub(".*_|[.].*", "", test)

# extract everything that is not a _ provided it is immediately followed by .
library(gsubfn)
strapply(test, "([^_]+)[.]", simplify = TRUE)