gregexpr2             package:Biostrings             R Documentation

_A _r_e_p_l_a_c_e_m_e_n_t _f_o_r _R _s_t_a_n_d_a_r_d _g_r_e_g_e_x_p_r _f_u_n_c_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     This is a replacement for the standard gregexpr function that does
     exact matching only. Standard gregexpr() misses matches when they
     are overlapping. The gregexpr2 function finds all matches but it
     only works in "fixed" mode i.e. for exact matching (regular
     expressions are not supported).

_U_s_a_g_e:

       gregexpr2(pattern, text)

_A_r_g_u_m_e_n_t_s:

 pattern: character string to be matched in the given character vector 

    text: a character vector where matches are sought 

_V_a_l_u_e:

     A list of the same length as 'text' each element of which is an
     integer vector as in 'gregexpr', except that the starting
     positions of all (even overlapping) matches are given. Note that,
     unlike 'gregexpr', 'gregexpr2' doesn't attach a "match.length"
     attribute to each element of the returned list because, since it
     only works in "fixed" mode, then all the matches have the length
     of the pattern. Another difference with 'gregexpr' is that with
     'gregexpr2', the 'pattern' argument must be a single (non-NA,
     non-empty) string.

_A_u_t_h_o_r(_s):

     H. Pages

_S_e_e _A_l_s_o:

     'gregexpr', 'matchPattern'

_E_x_a_m_p_l_e_s:

         gregexpr("aa", c("XaaaYaa", "a"), fixed=TRUE)
         gregexpr2("aa", c("XaaaYaa", "a"))

