Skip to content
Snippets Groups Projects
Commit 4d0caf0e authored by Lais Frigério's avatar Lais Frigério
Browse files

Issue #10: Regex - when the line start with a different character than quotes

parent 283e1178
No related branches found
No related tags found
2 merge requests!51Merge development to master,!30Parse config and proxy fle
...@@ -96,14 +96,20 @@ bool isValid(std::string* line) { ...@@ -96,14 +96,20 @@ bool isValid(std::string* line) {
normalize(line); normalize(line);
int i = 0; int i = 0;
std::cout << "line: " << (*line) << std::endl;
/* if the line is a comment */ /* if the line is a comment */
if (std::regex_match((*line), std::regex("((\\/\\/)|(\\/\\*)|(\\#))(.*)"))) if (std::regex_match((*line), std::regex("((\\/\\/)|(\\/\\*)|(\\#))(.*)")))
return false; 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; return false;
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment