Next: , Previous: GNU Searching, Up: GNU Regex Functions


14.7.1.5 Matching and Searching with Split Data

Using the functions re_match_2 and re_search_2, you can match or search in data that is divided into two strings.

The function:

     int
     re_match_2 (struct re_pattern_buffer *buffer,
                 const char *string1, const int size1,
                 const char *string2, const int size2,
                 const int start,
                 struct re_registers *regs,
                 const int stop)

is similar to re_match (see GNU Matching) except that you pass two data strings and sizes, and an index stop beyond which you don't want the matcher to try matching. As with re_match, if it succeeds, re_match_2 returns how many characters of string it matched. Regard string1 and string2 as concatenated when you set the arguments start and stop and use the contents of regs; re_match_2 never returns a value larger than size1 + size2.

The function:

     int
     re_search_2 (struct re_pattern_buffer *buffer,
                  const char *string1, const int size1,
                  const char *string2, const int size2,
                  const int start, const int range,
                  struct re_registers *regs,
                  const int stop)

is similarly related to re_search.