What is best way to parse text(config files) where are diffirent "styles" to set variable:
var_name = "Content" // comment
var_name2 = Content // comment
set var_name3 "Content" // comment
Var_name4=Content // comment
I need only var_name and content, ignore "set" and "// ..."
You may be able to use a regexp to parse them all:
^\s*(?:set\s+)?(\w+)(?:\s*=\s*)?"?([^"]*?)"?\s*(?://.*)?$
$1
is the variable name, $2
is the value.
This has one bug: If you put //
inside the quoted content, it will be treated as the beginning of a comment.