diff options
| author | Aotrix <[email protected]> | 2025-03-21 03:02:59 +0100 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2025-03-21 03:02:59 +0100 |
| commit | 04f6a758a0cc32574be220cb9ca2550b8a171310 (patch) | |
| tree | c94468ff64a78eea83f6e1d0d769b957a9a9bca5 /src/postgresHandler.cpp | |
| parent | 332c0ffde6d60b7bac3cb14df31cbae3f27383a7 (diff) | |
changed std::string_view to std::string for regex
Diffstat (limited to 'src/postgresHandler.cpp')
| -rw-r--r-- | src/postgresHandler.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/postgresHandler.cpp b/src/postgresHandler.cpp index 212202e..a92faaf 100644 --- a/src/postgresHandler.cpp +++ b/src/postgresHandler.cpp @@ -17,9 +17,14 @@ void display_query_result(const pqxx::result &t_r) { } } -void add_cards_to_database(std::string_view t_cards, pqxx::work &t_tx) { +void add_cards_to_database(const std::string &t_cards, pqxx::work &t_tx) { // TODO: to complete std::cout << "adding cards..." << std::endl; - std::regex key_regex; // TODO: to define - std::cout << t_cards.substr(1, 6) << std::endl; + std::regex key_regex("(\".*\"),"); // TODO: write correct regex + auto words_begin = + std::sregex_iterator(t_cards.begin(), t_cards.end(), key_regex); + auto words_end = std::sregex_iterator(); + for (auto it = words_begin; it != words_end; ++it) { + std::cout << (*it).str() << std::endl; + } } |
