SyntaxFix
Write A Post
Hire A Developer
Questions
> grepl("^[^_]+_1",s) [1] FALSE > grepl("^[^_]+_2",s) [1] TRUE
basically, look for everything at the beginning except _, and then the _2.
_
_2
+1 to @Ananda_Mahto for suggesting grepl instead of grep.
grepl
grep