summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAotrix <[email protected]>2025-03-22 00:04:53 +0100
committerAotrix <[email protected]>2025-03-22 00:04:53 +0100
commite60c3f1659e79324318ed3b0b3947e023992428c (patch)
tree40bf7627dd29fa9212f69f0b0edbad8b1487e27c
parent3dfed95e831e65f02e62bec2b4c24ca9959f212c (diff)
regex seems to work
-rw-r--r--resources/token_info.txt2
-rw-r--r--src/postgresHandler.cpp6
2 files changed, 6 insertions, 2 deletions
diff --git a/resources/token_info.txt b/resources/token_info.txt
index 565db7c..b238169 100644
--- a/resources/token_info.txt
+++ b/resources/token_info.txt
@@ -1 +1 @@
-EUYEPGK48vlJ2yGdmPRQkh5fYLIH6spP4M 484055 \ No newline at end of file
+EUYEPGK48vlJ2yGdmPRQkh5fYLIH6spP4M 484079 \ No newline at end of file
diff --git a/src/postgresHandler.cpp b/src/postgresHandler.cpp
index 256bf06..f5b603b 100644
--- a/src/postgresHandler.cpp
+++ b/src/postgresHandler.cpp
@@ -20,7 +20,11 @@ void display_query_result(const pqxx::result &t_r) {
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: write correct regex
+ std::regex key_regex(
+ "\"[^\"?]+\":([0-9]+|\"[^\"?]*\"|\\[([0-9,]*)\\]|null)"); // TODO:
+ // write
+ // correct
+ // regex
auto words_begin =
std::sregex_iterator(t_cards.begin(), t_cards.end(), key_regex);
auto words_end = std::sregex_iterator();