+bad_regex::bad_regex(const string &w, const string &e, const string::const_iterator &i):
+ logic_error(w+"\n"+make_where(e, i))
+{ }
+
+string bad_regex::make_where(const string &e, const string::const_iterator &i)
+{
+ string result;
+ string::size_type offset = i-e.begin();
+ if(offset>40)
+ {
+ result = e.substr(offset-40, 60);
+ offset = 40;
+ }
+ else
+ result = e.substr(0, 60);
+ result += '\n';
+ result.append(offset, ' ');
+ result += '^';
+ return result;
+}
+
+