From 4d0caf0ed960589f7db79c8171c4cd9d0f6104f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lais=20Frig=C3=A9rio?= <lfs@inf.ufpr.br> Date: Wed, 14 Dec 2016 11:29:22 -0200 Subject: [PATCH] Issue #10: Regex - when the line start with a different character than quotes --- update/agent/src/linux/datasid-parse.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/update/agent/src/linux/datasid-parse.cpp b/update/agent/src/linux/datasid-parse.cpp index f58bfc3d..1ff26c8e 100644 --- a/update/agent/src/linux/datasid-parse.cpp +++ b/update/agent/src/linux/datasid-parse.cpp @@ -96,14 +96,20 @@ bool isValid(std::string* line) { normalize(line); int i = 0; + std::cout << "line: " << (*line) << std::endl; + /* if the line is a comment */ if (std::regex_match((*line), std::regex("((\\/\\/)|(\\/\\*)|(\\#))(.*)"))) return false; - /* if the line start with a different character than quote */ + /* + * if the line start with a different character than quote + * Note: this work only for character = letter. + * Case a special character, like ":", "#", it doesn't work. + */ - if (std::regex_match((*line), std::regex("((\\=)|(\\])|(\\[)|(\\{)|(\\})|(\\:))(.*)"))) + if (!std::regex_match((*line), std::regex("(\")(.*)"))) return false; /* -- GitLab