Home:ALL Converter>How to get the ranges of all the non-matches in the string by regex?

How to get the ranges of all the non-matches in the string by regex?

Ask Time:2016-02-17T16:30:58         Author:Valeriy

Json Formatter

I have a regular expression and a string. I need to find all the non-matches in the string is a regular expression and get the ranges in the string. How can I do this?

#include <regex>
#include <string>
#include <iostream>

void printNonMatches(const std::regex& re, const std::string& str) {
    const std::string& part;
    size_t start;
    size_t end;

    /* get next non-match */
    /* std::cout << part << " : " << start << ", " << end << std::endl; */
}

Author:Valeriy,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/35451465/how-to-get-the-ranges-of-all-the-non-matches-in-the-string-by-regex
yy