Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
@"
(?=\S)(?<text>(?<comment>(?<open>[#;]+)(?:[^\S\r\n]*)(?<value>.+))|(?<section>(?<open>\[)(?:\s*)(?<value>[^\]]*\S+)(?:[^\S\r\n]*)(?<close>\]))|(?<entry>(?<key>[^=\r\n\[\]]*\S)(?:[^\S\r\n]*)(?<delimiter>:|=)(?:\s*(?<value>\{(?:[^{}""]+|""(?:\\.|[^""])*""|(?<o>\{)|(?<-o>\}))*(?(o)(?!))\})|((?:[^\S\r\n]*)(?<value>[^#;\r\n]*))))|(?<undefined>.+))(?<=\S)|(?<linebreaker>\r\n|\n)|(?<whitespace>[^\S\r\n]+)
"
ig
Input 1
1
New
; Comment above the section Key0=Value0 # Global entries [Section 1] Key=Value [EmptySection] Dummy text ;Commented Key=Value ;The following empty lines are ignored ; # [ Section 2 ]#Comment after [section] Key 1 = Value 1 Key2 = Value 2 and [text in square brackets] EmptyKey= JsonKey = { "a":"b" } [];Noname section ignored [ Section2 ] Dummy text after section Key3 =Value 3 (symbols [] are included) ;Inline comment #Key4 = Value 4 has been commented Dummy text before section [ Sectionnum3 ] Key 5 = Value 5 Key6 =Value6
Extraction