I have a vector of strings like this
test <- c("Dcl2_SsHV2L_2_CAAAAG_L003_R1_001", "Dcl2_SsHV2L_2_CAAAAG_L003_R1_001",
"Dcl2_SsHV2L_2_CAAAAG_L003_R1_001", "Dcl1_SsHV2L_2_GGTAGC_L003_R1_001")
I need to delete everything after "SsHV2L" and get only
Dcl2_SsHV2L
Dcl2_SsHV2L
Dcl2_SsHV2L
Dcl1_SsHV2L
I tried: gsub("SsHV2L.*","",test)
what is the proper way of doing it?