Parsing key-value entries from Windows .INI files

Q

How to write a regular expression to parse key-value entries from Windows .INI files?

Here is an example Windows .INI file, system.ini:

✍: FYIcenter.com

A

Here is a regular expression to parse file entries from output of the "dir" command on Windows systems: with multiple lines modifier "m": Note that:

(\s*(.+?)\s*=   - capture the key name before '='
=\s*(.+)        - capture the value after '=' and excluding '#'

Click the button to test this regular expression here online:

2019-09-16, 0👍, 2💬