I am using R in Ubuntu, and trying to go over list of files, some of them i need and some of them i don't need,
I try to get the one's i need by finding a sub string in them, that need to appear exactly once,
i am using the function grep, that i found here grep function in r
and using the regex rules that i found here regex rules
and when taking the simple example
a <- c("a","aa")
grep("a{1}", a)
i would expect to get only the strings that contain "a" exactly one time, and instead of it i get both of them.
when i use the 2 instead of 1, i do get the wanted result of one strings (the one that contains "aa")
i can't use $ because this is not the end of the word for the words i need, for example i need to take those two words "germ-pass.tab", "germ-pass_germ-pass.tab" and return only the first that contains "germ-pass" once and once only
i cant use ^a because i don't need words such as "aca"
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…