RFE: better INI inspectors / parsing with regular expressions as workaround

Have you tried using variables of file inspector?

// the variables of file inspector parses ini files, and produces strings in the form of [sectionname].name=value
// for your examples, it produces
q: variables of file "C:\Temp\test.ini"
A: [SECTION1].Signature="$Windows NT$"
A: [SECTION1].Provider=%25MANUFACTURER%25
A: [SECTION1].ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
A: [SECTION1].Class=Printer
A: [SECTION1].CatalogFile=mydriver.cat
A: [SECTION1].DriverVer=06/17/2014,61.170.01.18326
A: [SECTION1].DriverIsolation=2
A: [MANUFACTURER].%25MANUFACTURER%25=MYCOMPANY,NTAMD64
A: [MYCOMPANY.NTAMD64]."Key 1"="Value 1"
A: [MYCOMPANY.NTAMD64]."Key 2"="Value 2"
A: [MYCOMPANY.NTAMD64]."Key 3"="Value 3"
A: [MYCOMPANY.NTAMD64]."Key 4"="Value 4"
A: [MYCOMPANY.NTAMD64]."Key 5"="Value 5"
A: [SECTION4]."Key 1"="Value 1"
A: [SECTION4]."Key 2"="Value 2"
T: 0.435 ms

// here are your relevances, followed by how you would get the same thing using 'variables of <file>'
// The "key of section of file" inspector is ok, if the names of the section and key and known
q: key "Class" of section "SECTION1" of file "C:\Temp\test.ini"
A: Printer
T: 0.560 ms

// using  'variables'
q: following text of first "=" of variables whose ( it starts with "[SECTION1].Class=") of file "C:\Temp\test.ini"
A: Printer
T: 0.456 ms

// Retrieve the section names if they are not known
q: substrings separated by "%0d%0a" of matches(regex("\[[^]]*\]")) of concatenation "%0d%0a" of lines whose (it as trimmed string does not start with ";") of file "C:\Temp\test.ini" as trimmed string
A: [SECTION1]
A: [MANUFACTURER]
A: [MYCOMPANY.NTAMD64]
A: [SECTION4]
T: 0.677 ms

// using 'variables'
q: (it & "]") of unique values of (preceding text of first "]." of it ) of variables of file "C:\Temp\test.ini"
A: [MANUFACTURER]
A: [MYCOMPANY.NTAMD64]
A: [SECTION1]
A: [SECTION4]
T: 0.438 ms

// Key names within a known section, section name is case-insensitive "[MYCOMPANY.NTAMD64]"
q: preceding texts of firsts "=" of substrings separated by "%0d%0a" of matches(regex("\[[Mm][Yy][Cc][Oo][Mm][Pp][Aa][Nn][Yy][.][Nn][Tt][Aa][Mm][Dd]64\][^[]*")) of concatenation "%0d%0a" of lines whose (it as trimmed string does not start with ";") of file "C:\Temp\test.ini" as trimmed string
A: "Key 1"
A: "Key 2"
A: "Key 3"
A: "Key 4"
A: "Key 5"
T: 0.924 ms

// using variables
q: (following text of first "]." of preceding texts of first "=" of it) of variables whose ( it as uppercase starts with "[MYCOMPANY.NTAMD64]") of file "C:\Temp\test.ini"
A: "Key 1"
A: "Key 2"
A: "Key 3"
A: "Key 4"
A: "Key 5"
T: 0.476 ms

// Values of all keys in the section
q: following texts of firsts "=" of substrings separated by "%0d%0a" of matches(regex("\[[Mm][Yy][Cc][Oo][Mm][Pp][Aa][Nn][Yy][.][Nn][Tt][Aa][Mm][Dd]64\][^[]*")) of concatenation "%0d%0a" of lines whose (it as trimmed string does not start with ";") of file "C:\Temp\test.ini" as trimmed string
A: "Value 1"
A: "Value 2"
A: "Value 3"
A: "Value 4"
A: "Value 5"
T: 0.680 ms

// using variables
q: (following text of first "=" of it) of variables whose ( it as uppercase starts with "[MYCOMPANY.NTAMD64]") of file "C:\Temp\test.ini"
A: "Value 1"
A: "Value 2"
A: "Value 3"
A: "Value 4"
A: "Value 5"
T: 0.423 ms

// Easier if the case of a section name can be assumed
q: following texts of firsts "=" of substrings separated by "%0d%0a" of matches(regex("\[SECTION4\][^[]*")) of concatenation "%0d%0a" of lines whose (it as trimmed string does not start with ";") of file "C:\Temp\test.ini" as trimmed string
A: "Value 1"
A: "Value 2"
T: 0.643 ms

// using variables
q: (following text of first "=" of it) of variables whose ( it starts with "[SECTION4]") of file "C:\Temp\test.ini"
A: "Value 1"
A: "Value 2"
T: 0.452 ms

// Full content of a section with a known name
q: substrings  separated by "%0d%0a" whose (it as trimmed string != "" and it contains "=") of matches(regex("\[[Mm][Yy][Cc][Oo][Mm][Pp][Aa][Nn][Yy][.][Nn][Tt][Aa][Mm][Dd]64\][^[]*")) of concatenation "%0d%0a" of lines whose (it as trimmed string does not start with ";") of file "C:\Temp\test.ini" as trimmed string
A: "Key 1" = "Value 1"
A: "Key 2" = "Value 2"
A: "Key 3" = "Value 3"
A: "Key 4" = "Value 4"
A: "Key 5" = "Value 5"
T: 0.777 ms

// using  'variables'
q: following texts of firsts "]." of variables whose ( it as uppercase starts with "[MYCOMPANY.NTAMD64]") of file "C:\Temp\test.ini"
A: "Key 1"="Value 1"
A: "Key 2"="Value 2"
A: "Key 3"="Value 3"
A: "Key 4"="Value 4"
A: "Key 5"="Value 5"
T: 0.542 ms
2 Likes