Skip to content
Snippets Groups Projects
  • Rob Swindell's avatar
    dd37a468
    New findstr functions that can search for (up to) two strings in one go · dd37a468
    Rob Swindell authored
    Many searches are done (e.g. in the mail server, QWK import) for either of 2
    strings in single file or list, so let's optimize that to a single iteration
    through the file/list. This should reduce some redundant file I/O.
    
    I do find this API a little confusing with the filename or list at the end
    of the argument list, but kept it consistent with the existing single string
    findstr functions (which are now just wrappers for the new 2-string flavors).
    
    I noticed during this update that findstr() did not share the same behavior
    as findstr_in_list() (feature added in commit f08f2137) whereby if all the
    patterns were negative searches (beginning with '!'), then *all* the
    negative matches would have to be successful (not just the first) for the
    function to return true. So now findstr() behaves like findstr_in_list()
    in this regard.
    
    I also added some optimizations to findstr_in_string().
    dd37a468
    History
    New findstr functions that can search for (up to) two strings in one go
    Rob Swindell authored
    Many searches are done (e.g. in the mail server, QWK import) for either of 2
    strings in single file or list, so let's optimize that to a single iteration
    through the file/list. This should reduce some redundant file I/O.
    
    I do find this API a little confusing with the filename or list at the end
    of the argument list, but kept it consistent with the existing single string
    findstr functions (which are now just wrappers for the new 2-string flavors).
    
    I noticed during this update that findstr() did not share the same behavior
    as findstr_in_list() (feature added in commit f08f2137) whereby if all the
    patterns were negative searches (beginning with '!'), then *all* the
    negative matches would have to be successful (not just the first) for the
    function to return true. So now findstr() behaves like findstr_in_list()
    in this regard.
    
    I also added some optimizations to findstr_in_string().