X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fstrings%2Fregex.cpp;h=5307c6990286ba373291281fb4ee230ff81d2d07;hb=HEAD;hp=832cd85b110ac81d245af918375ddd24256727ef;hpb=31cc8f0c6e874e2417e76eda50af34fd17bcd90c;p=libs%2Fcore.git diff --git a/source/strings/regex.cpp b/source/strings/regex.cpp index 832cd85..5307c69 100644 --- a/source/strings/regex.cpp +++ b/source/strings/regex.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "format.h" #include "regex.h" @@ -56,7 +57,6 @@ string bad_regex::make_where(const string &e, const string::const_iterator &i) Regex::Regex(const string &expr) { - n_groups = 0; auto iter = expr.begin(); code = compile(expr, iter, n_groups, false); ++n_groups; @@ -130,7 +130,8 @@ Regex::Code Regex::compile(const string &expr, string::const_iterator &iter, uns Count repeat_min = 1; Count repeat_max = 1; - parse_repeat(expr, i, repeat_min, repeat_max); + if(i!=end) + parse_repeat(expr, i, repeat_min, repeat_max); for(unsigned j=0; j