RegEx/Unix/Conf_Line.regex.txt

# Matches Lines in a .conf or .ini file.
(?m) # Set Multiline mode
# A Configuration line can either be a comment line, a blank line, or a line with a value
(^[\;\#](?<Comment>(?:.|\s)+?(?=\z|$)) # Lines that start with ; or are comments
|^\s+$ # Blank lines will also match, but not be captured
|(?<Key>^[\w\s\.\-]+) # Otherwise, the first word is the name
\s?(?<Delimeter>[\=\:]) # Followed by an equals or colon (surrounded by optional whitespace)
\s?(?<Value>(?:.|\s)+?(?=\z|$)) # Anything until the end of line is the value
|(?<Line>^.$))