# How to use ConfParser.jl to read INI file with custom comment prefix

**URL:** <https://discourse.julialang.org/t/how-to-use-confparser-jl-to-read-ini-file-with-custom-comment-prefix/48652>\
**Category:** General Usage\
**Created:** [October 19, 2020, 8:11pm UTC](https://discourse.julialang.org/t/how-to-use-confparser-jl-to-read-ini-file-with-custom-comment-prefix/48652 "2020-10-19T20:11:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vsskanth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vsskanth/32/18343_2.png) [@vsskanth](https://discourse.julialang.org/u/vsskanth)\
**Post date:** [October 19, 2020, 8:11pm UTC](https://discourse.julialang.org/t/how-to-use-confparser-jl-to-read-ini-file-with-custom-comment-prefix/48652/1 "2020-10-19T20:11:23Z")

</div>

I’m new to Julia and I am trying to convert a piece of python code that reads a TIR file (which is like an INI file with different prefixes for comments).

```python
    tir_parser = ConfigParser(
        strict = False,
        comment_prefixes=('$','!'),
        inline_comment_prefixes=('$','!'),
        )
    tir_parser.optionxform = str # preserve case
    tir_parser.read(tir_file)

```

I tried IniFile first but it wasn’t separating out inline comments. Tried ConfParser next but it does not seem to have any option to define custom prefixes for comments. I’ve pasted an example snippet of a TIR file below. Any suggestions are appreciated.

```julia
[MDI_HEADER]
FILE_TYPE = 'tir'
FILE_VERSION = 3.000000            
FILE_FORMAT = 'ASCII'
! COMMENT : Nom. section width (m) 0.245
! COMMENT : Nom. aspect ratio (-) 0.700
! COMMENT : Rim radius (m) 0.1905
$--------------------------------------------------------------vertical
[VERTICAL]
FNOMIN = 4448.000000 $Nominal wheel load
VERTICAL_STIFFNESS = 100.000000 $Tyre vertical stiffness
VERTICAL_DAMPING = 50.000000 $Tyre vertical damping
MC_CONTOUR_A = 0.000000 $Motorcycle contour ellips A
MC_CONTOUR_B = 0.000000 $Motorcycle contour ellips B
BREFF = 0.000000 $Low load stiffness effective rolling radius
DREFF = 0.000000 $Peak value of effective rolling radius
FREFF = 0.000000 $High load stiffness effective rolling radius

```

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [October 20, 2020, 8:24am UTC](https://discourse.julialang.org/t/how-to-use-confparser-jl-to-read-ini-file-with-custom-comment-prefix/48652/2 "2020-10-20T08:24:55Z")

</div>

> [@vsskanth](#):
>
> I’ve pasted an example snippet of a TIR file below. Any suggestions are appreciated.

Depending on the complexity of the syntax, you could just write your own parser, eg with [regular expressions](https://docs.julialang.org/en/v1/manual/strings/#Regular-Expressions) examining each line to match various patterns, then extract and parse the values.
