X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fstrings%2Fregex.cpp;h=5307c6990286ba373291281fb4ee230ff81d2d07;hb=HEAD;hp=27361b038b168071cabd98aa45a37e37fb27d9cc;hpb=44da9fc9afb6b7e49c1558c5572213a1e6f401e8;p=libs%2Fcore.git diff --git a/source/strings/regex.cpp b/source/strings/regex.cpp index 27361b0..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(-(atom.size()+jump_size), result); + write_int(-static_cast(atom.size()+jump_size), result); } else if(repeat_max>repeat_min) { @@ -477,7 +478,7 @@ bool Regex::run(const string &str, const string::const_iterator &begin, vector