I need to re-shape my data frame using regexp and, in particular, this kind of line
X21_GS04.A.mzdata
must became:
GS04.A
I tryed
pluto <- sub('^X[0-90_]+','', my.data.frame$File.Name, perl=TRUE)
and it works; than I tryed
pluto <- sub('.mzdata$','', my.data.frame$File.Name, perl=TRUE)
and it works too.
The problem is that I have no idea how to combine the two code in one, I tryed a script such this
pluto <- sub('^X[0-90_]+ | .mzdata$','', my.data.frame$File.Name, perl=TRUE)
but nothing appens.
Can someone say to me where I wrong??
Best
Riccardo
Remove space in your regex. Also escape
.char:\., i.e.: