© Moritz Lenz 2020
M. LenzRaku Fundamentals https://doi.org/10.1007/978-1-4842-6109-5_9

9. Parsing INI Files Using Regexes and Grammars

Moritz Lenz1 
Fürth, Bayern, Germany

You’ve probably seen .ini files before; they are quite common as configuration files on the Microsoft Windows platform but are also found in many other places such as ODBC configuration files, Ansible’s inventory files,1 and so on.

This is what they look like:
key3 = with spaces
; comment lines start with a semicolon, and are
; ignored by the parser

Raku offers regexes for parsing and grammars for structuring and reusing regexes.

You could use the Config::INI2 module (after installing with zef install Config::INI) to parse files ...

Get Raku Fundamentals: A Primer with Examples, Projects, and Case Studies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.