Not sure it's exactly what you want but you could use gregexpr. If you're
worried about your search string starting within your search string (like
your example) then maybe you could find one match at a time, mask it out
with gsub, and loop until you don't have any more matches:
search<-'cc'
mask
Hi R users,
I am trying generate the indices for locating a in the string it come from.
Given the length of the string, it will take too long using the combn() for
further comparison. I am wondering if R has any built-in function for this
purpose.
To make it concrete:
this.substring="cc"
this
2 matches
Mail list logo