Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint
  • Loading branch information
lemire authored and anonrig committed Jan 22, 2025
commit 981993c7303ae89bfefd663def8055cc749cb773
4 changes: 2 additions & 2 deletions include/ada/url_pattern_regex.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class std_regex_provider {
using regex_type = std::regex;
static std::optional<regex_type> create_instance(std::string_view pattern,
bool ignore_case);
std::vector<std::string> regex_search(
std::string_view input, const regex_type& pattern);
std::vector<std::string> regex_search(std::string_view input,
const regex_type& pattern);
bool regex_match(std::string_view input, const regex_type& pattern);
};

Expand Down
19 changes: 10 additions & 9 deletions src/url_pattern_regex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ std::optional<std::regex> std_regex_provider::create_instance(

std::vector<std::string> std_regex_provider::regex_search(
std::string_view input, const std::regex& pattern) {
std::vector<std::string> matches;
std::string input_str(
input.begin(),
input.end()); // Convert string_view to string for regex_search
std::smatch match_result;

std::vector<std::string> matches;
std::string input_str(input.begin(), input.end()); // Convert string_view to string for regex_search
std::smatch match_result;

while (std::regex_search(input_str, match_result, pattern)) {
matches.push_back(match_result.str());
input_str = match_result.suffix().str();
}
return matches;
while (std::regex_search(input_str, match_result, pattern)) {
matches.push_back(match_result.str());
input_str = match_result.suffix().str();
}
return matches;
}

bool std_regex_provider::regex_match(std::string_view input,
Expand Down