www.delorie.com/gnu/docs/regex/regex_49.html   search  
 
Buy the book!


Regex

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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 section 7.1.3 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.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003