I have a string R, with the format
s = `"[some letters and numbers]_[a number]_[more numbers, letters, punctuation, etc, anything]"`
I just want to check if s contains "_2" in the first position. In other words, after the first character _ , is this the singular a "2"? How to do it in R?
I guess I need some kind of complex regex expression?
Examples:
39820432_2_349802j_32hfh = TRUE
43lda821_9_428fj_2f = FALSE (note that there is _2 , but not in the right place)
contains r
StanLe Nov 19 '13 at 2:29 2013-11-19 02:29
source share