kakoune/src/regex.cc
Maxime Coste 1834a67b87 Go back to libc locale and use c_regex_traits
Unfortunately, cygwin does not support c++ locales.
2016-05-19 21:45:23 +01:00

25 lines
454 B
C++

#include "regex.hh"
#include "exception.hh"
namespace Kakoune
{
using Utf8It = RegexUtf8It<const char*>;
Regex::Regex(StringView re, flag_type flags) try
: RegexBase{Utf8It{re.begin(), re}, Utf8It{re.end(), re}}, m_str(re.str())
{} catch (std::runtime_error& err) { throw regex_error(err.what()); }
String option_to_string(const Regex& re)
{
return re.str();
}
void option_from_string(StringView str, Regex& re)
{
re = Regex{str};
}
}