--- a/src/Soros.cxx 2022-06-27 09:36:46.486075920 +0100 +++ b/src/Soros.cxx 2022-06-27 09:37:52.594072196 +0100 @@ -98,8 +98,8 @@ s = regex_replace(s, quoteEnd, L""); s = translate(s, c.substr(1), m.substr(1), L""); replace(s, slash, L"\\\\"); // -> \\, ", ;, # - begins.push_back(s[0] == L'^'); - ends.push_back(s[s.length()-1] == L'$'); + begins.push_back(!s.empty() && s[0] == L'^'); + ends.push_back(!s.empty() && s[s.length()-1] == L'$'); s = L"^" + regex_replace(s, wregex(L"^\\^"), L""); s = regex_replace(s, wregex(L"\\$$"), L"") + L"$"; try