Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Jan 20, 2025
1 parent 8087c1d commit cda0718
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
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

0 comments on commit cda0718

Please sign in to comment.