Suppose I have a string:
string = "VNYTQAKENGSD"
And I need to find the positions where this expression holds.
N{P}[ST]{P} (Meaning 4 letters, [N,¬P,S or T, ¬P]
The output would be
2 9
because at position 2 you have NYTQ and at 9 NGSD
How to write this in regular expressions?
consider regex as the regular expressiom
 for(i in 1:nchar(string)){
 # If regex is equal to the substring of REGEX, get index.
   if(regex == substr(string, 1, nchar(regex))){
   vector = c(vector,i)
   } 
 #Reduce String
 string = substring(string,2)
 }  
Please help
 
    