ini-parser
ini-parser copied to clipboard
Multiple comment character
Hi,
Standard ini file allow to use for comment line both "#" and ";" as comment char, but current version not supported multiple comment char.
Possible solution:
add [] in _strCommentRegex in IniParserConfiguration.cs
like: protected const string _strCommentRegex = @"^[{0}](.*)";
Regard, Andriy
This solution fix also a bug if you try to use "[", "]" , "(", ")" etc. as comment string
Regard, Andriy
@Malij75 did you try Configuration.CommentRegex option?
Hi, yes i try to use Configuration.CommentRegex, but if you format strCommentRegex @"^{0}(.)" and replase {0} with configured comment string "#;" will result in regex "^#;(._)" and test for string ";comment will be fail. Right pattern is "^#;"
if you use "[" as a comment string then pattern for comment regex "^[(._)" is wrong. Right pattern is "^["
I think I didn't considered using multiple comment characters. I'll take a look at your improvements, thanks
Hi I found a regex that works for C#: parser.Configuration.CommentRegex = new Regex(@"(#|;)(.*)");