| 713 | } |
| 714 | |
| 715 | bool String::regexMatch(String const& regex, bool full, bool caseSensitive) const { |
| 716 | re2::RE2::Options options; |
| 717 | options.set_case_sensitive(caseSensitive); |
| 718 | RE2 re(regex.utf8(), options); |
| 719 | if (!re.ok()) |
| 720 | throw StringException::format("Regex pattern is invalid: {}", re.error()); |
| 721 | |
| 722 | return full ? RE2::FullMatch(utf8(), re) : RE2::PartialMatch(utf8(), re); |
| 723 | } |
| 724 | int String::compare(String const& s, CaseSensitivity cs) const { |
| 725 | if (cs == CaseSensitive) |
| 726 | return m_string.compare(s.m_string); |