Fix regex for key-value-pair
First group was a greedy match for the key, followed by a greedy match for the whitespace up to the '='. This caused the white space to become a suffix of the key... Solved by making it a non-greedy match.
This commit is contained in:
parent
1da96ede92
commit
37c866054a
@ -93,7 +93,7 @@ map<string, string> sc::parse_ini_file(const string& path, bool ignore_sections)
|
||||
prefix = string{m[1]} + '.';
|
||||
}
|
||||
}
|
||||
regex key_value_pat {R"(^\s*(.*)\s*=\s*("?)(.*)\2)"};
|
||||
regex key_value_pat {R"(^\s*(.*?)\s*=\s*("?)(.*)\2)"};
|
||||
smatch match;
|
||||
if (regex_search(line, match, key_value_pat)) {
|
||||
result[prefix + string{match[1]}] = match[3];
|
||||
|
Loading…
x
Reference in New Issue
Block a user