dimanche 24 mars 2019

What is the runtime of a regex_search() operation in c++?

I've looked at the documentation for the C++11 regex library and can't seem to find anything on the runtime of its regex_search() method. Suppose I have a string of n length and a pattern of length m, how can I analyze the complexity of this search?

Below is an example of using this method to find and print occurrences where the string is of an alphabetical letter and a digit:

How do I find the runtime of this?

string s = "h2ello1";
regex re("[a-z]{1}[0-9]{1}");
smatch m;

while(regex_search(s,m,re)){
    cout << m[0] << endl;
    m.suffix().str();
};


Aucun commentaire:

Enregistrer un commentaire