From: Steven Watanabe (steven_at_[hidden])
Date: 2006-07-29 15:41:01


AMDG

The following regular expression seems to cover all the cases:

    boost::regex min_max_regex(
        "((^\\s*#\\s*undef\\s*\\b(min|max)\\b)|" //#undef min/max
        "(\\b(min|max)\\b\\s*\\())|" //min/max(...
        "(\"[^\"]*\")|" //character array literals
        "(\'[^\']*\')|" //character literals
        "(/\\*.*?\\*/)|" // /**/ comments
        "(//.*?$)", // // comments
        boost::regex::normal
    );

There is an error iff match_results[1].matched is true.
All that is required is to use regex_search instead of regex_iterator
and to skip to the end of each match before continuing.

In Christ,
Steven Watanabe