| 16668 | } // namespace |
| 16669 | |
| 16670 | std::string escape_regexp_string(std::string_view input) { |
| 16671 | // Assert: input is an ASCII string. |
| 16672 | ADA_ASSERT_TRUE(idna::is_ascii(input)); |
| 16673 | // Let result be the empty string. |
| 16674 | std::string result{}; |
| 16675 | result.reserve(input.size()); |
| 16676 | for (const auto& c : input) { |
| 16677 | // TODO: Optimize this even further |
| 16678 | if (should_escape_regexp_char(c)) { |
| 16679 | result.append(std::string("\\") + c); |
| 16680 | } else { |
| 16681 | result.push_back(c); |
| 16682 | } |
| 16683 | } |
| 16684 | return result; |
| 16685 | } |
| 16686 | |
| 16687 | std::string process_base_url_string(std::string_view input, |
| 16688 | url_pattern_init::process_type type) { |
no test coverage detected