# \#parsing

**URL:** https://discourse.julialang.org/tag/parsing/514.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [\[ANN\] OptParse.jl – a composable, type-stable CLI parser](https://discourse.julialang.org/t/ann-optparse-jl-a-composable-type-stable-cli-parser/136580)

<div class="topic-metadata">

**Author:** [@cshen](https://discourse.julialang.org/u/cshen)\
**Replies:** 15\
**Last updated:** [June 28, 2026, 10:48pm UTC](https://discourse.julialang.org/t/ann-optparse-jl-a-composable-type-stable-cli-parser/136580 "2026-06-28T22:48:10Z")

</div>

\[ANN\] OptParse.jl – a composable, type-stable CLI parser Hi all, I’ve been working on OptParse.jl, a command-line argument parser for Julia built around three main ideas: type stability: the main goal was to make a CL…

---

## [Non-allocating way to parse section of string as number?](https://discourse.julialang.org/t/non-allocating-way-to-parse-section-of-string-as-number/137672)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 2\
**Last updated:** [June 17, 2026, 8:31pm UTC](https://discourse.julialang.org/t/non-allocating-way-to-parse-section-of-string-as-number/137672 "2026-06-17T20:31:57Z")

</div>

Given a big string with numbers in it like input = ";(,)\<mul(595,110)~ #(select()-?who():mul(732,729)+/;%@mul(924,700)" and I know at execution time exactly where a number is in the string, I can parse that section of …

---

## [Status of Julia parser for tree-sitter](https://discourse.julialang.org/t/status-of-julia-parser-for-tree-sitter/137537)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 4\
**Last updated:** [June 12, 2026, 6:14am UTC](https://discourse.julialang.org/t/status-of-julia-parser-for-tree-sitter/137537 "2026-06-12T06:14:21Z")

</div>

Which is the recommended tree-sitter parser for Julia? The “official” one seems to be unmaintained; pull requests are not looked at for months, etc. Among the forks, @aviatesk has recent commits.

---

## [Parse with exponent D](https://discourse.julialang.org/t/parse-with-exponent-d/133715)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 4\
**Last updated:** [November 7, 2025, 1:24pm UTC](https://discourse.julialang.org/t/parse-with-exponent-d/133715 "2025-11-07T13:24:04Z")

</div>

I tried parsing the values printed to file by some old Fortran code. This code uses the exponent D for double precision numbers, like 2.73150000000000003D+02. I can use the replace command to replace the “D” with “E”, …

---

## [Dates: Strict parsing (DateFormat)](https://discourse.julialang.org/t/dates-strict-parsing-dateformat/130274)

<div class="topic-metadata">

**Author:** [@Parazetamol](https://discourse.julialang.org/u/Parazetamol)\
**Replies:** 1\
**Last updated:** [June 27, 2025, 10:55am UTC](https://discourse.julialang.org/t/dates-strict-parsing-dateformat/130274 "2025-06-27T10:55:54Z")

</div>

Hi there, is it possible to have the parsing of the specified DateFormat strict ? I don’t want to have a string like “1:2” parsed as Time when explicitly specifying dateformat"HH:MM:SS". Time("1:2",dateformat"HH:MM:SS…

---

## [How to not import Base.isopen](https://discourse.julialang.org/t/how-to-not-import-base-isopen/128766)

<div class="topic-metadata">

**Author:** [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Replies:** 12\
**Last updated:** [May 18, 2025, 6:04pm UTC](https://discourse.julialang.org/t/how-to-not-import-base-isopen/128766 "2025-05-18T18:04:45Z")

</div>

I would like to write my own isopen function and therefore not import Base.isopen. I have thought of two ways to do this: module MyModule function isopen end # Lots of code... include("file\_that\_defines\_isopen.jl") en…

---

## [Extracting dates and values from a string](https://discourse.julialang.org/t/extracting-dates-and-values-from-a-string/125401)

<div class="topic-metadata">

**Author:** [@jovansam](https://discourse.julialang.org/u/jovansam)\
**Replies:** 9\
**Last updated:** [January 30, 2025, 10:02pm UTC](https://discourse.julialang.org/t/extracting-dates-and-values-from-a-string/125401 "2025-01-30T22:02:50Z")

</div>

I would appreciation any guidance. I have the text below and would like to extract all dates and the associated information within “dataX.push()” to end up with for instance: 2023-01-10, 0.0, 0.0, 0.0, 0.0; 2023-01-11, 0…

---

## [Parsing corporate DateTime format with calendar week](https://discourse.julialang.org/t/parsing-corporate-datetime-format-with-calendar-week/124725)

<div class="topic-metadata">

**Author:** [@dobby](https://discourse.julialang.org/u/dobby)\
**Replies:** 5\
**Last updated:** [January 14, 2025, 5:45pm UTC](https://discourse.julialang.org/t/parsing-corporate-datetime-format-with-calendar-week/124725 "2025-01-14T17:45:40Z")

</div>

Hi all, I have date time data in the following format: 2434.5 14:20 Which is for: year 2024, 34th week of the year (August), 5th day of the week (Friday), 14:20 o’clock. I am struggeling to parse the calendar week an…

---

## [\[ANN\] Lexbor.jl - HTML parser wrapping the C library lexbor](https://discourse.julialang.org/t/ann-lexbor-jl-html-parser-wrapping-the-c-library-lexbor/124538)

<div class="topic-metadata">

**Author:** [@mike](https://discourse.julialang.org/u/mike)\
**Replies:** 4\
**Last updated:** [January 9, 2025, 5:16pm UTC](https://discourse.julialang.org/t/ann-lexbor-jl-html-parser-wrapping-the-c-library-lexbor/124538 "2025-01-09T17:16:13Z")

</div>

Announcing Lexbor.jl, which provides HTML parsing and DOM queries via CSS selector syntax. Docs can be found at https://michaelhatherly.github.io/Lexbor.jl. This package is mostly just a wrapper around the GitHub - lexb…

---

## [How to read a line character by character?](https://discourse.julialang.org/t/how-to-read-a-line-character-by-character/122734)

<div class="topic-metadata">

**Author:** [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Replies:** 15\
**Last updated:** [November 19, 2024, 11:53am UTC](https://discourse.julialang.org/t/how-to-read-a-line-character-by-character/122734 "2024-11-19T11:53:02Z")

</div>

Hello, I have a file as follows: 1 2 3 4 5 6 7 8 9 10 I want to calculate the sum of the above numbers. With a command like below I read a whole line and not individual numbers: inn = open("input.txt", "r") inp = rea…

---

## [\[ANN\] Quasar.jl - Pure Julia OpenQASM 3 Lexing and Parsing](https://discourse.julialang.org/t/ann-quasar-jl-pure-julia-openqasm-3-lexing-and-parsing/121513)

<div class="topic-metadata">

**Author:** [@kslimes](https://discourse.julialang.org/u/kslimes)\
**Replies:** 2\
**Last updated:** [October 31, 2024, 6:23pm UTC](https://discourse.julialang.org/t/ann-quasar-jl-pure-julia-openqasm-3-lexing-and-parsing/121513 "2024-10-31T18:23:44Z")

</div>

Quasar.jl - Pure Julia OpenQASM3 lexing and parsing Links: GitHub Quasar.jl is a pure Julia package for lexing and parsing OpenQASM, a popular intermediate representation for quantum programs. Quasar supports: Subrout…

---

## [Parsing of multiple \`..\`](https://discourse.julialang.org/t/parsing-of-multiple/121843)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 6\
**Last updated:** [October 27, 2024, 11:43pm UTC](https://discourse.julialang.org/t/parsing-of-multiple/121843 "2024-10-27T23:43:21Z")

</div>

Why does this parse, julia\> :(a .. b) :(a .. b) but this does not, julia\> :(a .. b .. c) ERROR: ParseError: # Error @ REPL\[31\]:1:10 :(a .. b .. c) # └──┘ ── Expected \`)\` ?

---

## [Convert string to equation (fast)](https://discourse.julialang.org/t/convert-string-to-equation-fast/121259)

<div class="topic-metadata">

**Author:** [@Daniel\_Reimeir](https://discourse.julialang.org/u/Daniel_Reimeir)\
**Replies:** 12\
**Last updated:** [October 16, 2024, 9:19am UTC](https://discourse.julialang.org/t/convert-string-to-equation-fast/121259 "2024-10-16T09:19:35Z")

</div>

Hi, I’m pretty new to the Julia language and i have a problem with my program. Just a short background, I am a engineering student and my program shall be a Multibody simulation tool. I have already solved the mechanics…

---

## [Code review: parser and error propagation](https://discourse.julialang.org/t/code-review-parser-and-error-propagation/117563)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 3\
**Last updated:** [July 28, 2024, 3:07pm UTC](https://discourse.julialang.org/t/code-review-parser-and-error-propagation/117563 "2024-07-28T15:07:24Z")

</div>

I need to write parsers for ad-hoc data formats from time to time. I’ve always wondered if I’m propagating errors in a “Julian” way. I don’t know if it’s the best to represent errors by nothing as in Base.tryparse, a cus…

---

## [How to read a file and initialize tensors with it's values without having it in memory?](https://discourse.julialang.org/t/how-to-read-a-file-and-initialize-tensors-with-its-values-without-having-it-in-memory/117418)

<div class="topic-metadata">

**Author:** [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Replies:** 6\
**Last updated:** [July 25, 2024, 9:58am UTC](https://discourse.julialang.org/t/how-to-read-a-file-and-initialize-tensors-with-its-values-without-having-it-in-memory/117418 "2024-07-25T09:58:06Z")

</div>

I have a simple (but possibly enormous) text file which has five columns, the first one has a floating point value and the other four have integer values , it looks like F p q r s where basically I want to write a tens…

---

## [Error in parsing BaseModelica model](https://discourse.julialang.org/t/error-in-parsing-basemodelica-model/115851)

<div class="topic-metadata">

**Author:** [@thermal\_pro](https://discourse.julialang.org/u/thermal_pro)\
**Replies:** 3\
**Last updated:** [June 20, 2024, 4:36am UTC](https://discourse.julialang.org/t/error-in-parsing-basemodelica-model/115851 "2024-06-20T04:36:49Z")

</div>

I have been trying to parse a model to ModelingToolkit using the parse\_basemodelica function, available in Basemodelica.jl. But encounters the following error: "Error during FSM execution at buffer position 19. Last 19 …

---

## [Cast/parse multiple variables at once](https://discourse.julialang.org/t/cast-parse-multiple-variables-at-once/114345)

<div class="topic-metadata">

**Author:** [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)\
**Replies:** 5\
**Last updated:** [May 17, 2024, 8:42am UTC](https://discourse.julialang.org/t/cast-parse-multiple-variables-at-once/114345 "2024-05-17T08:42:27Z")

</div>

Hi, Having to process dates read from files, I’m currently doing e.g.: date="20240516235400" yyyy, mm, dd, h, m, s = parse(Int32, date\[1:4\]), parse(Int32, date\[5:6\]), parse(Int32, date\[7:8\]), parse(Int32, date\[9:10\]), …

---

## [Parsing a string with quotations](https://discourse.julialang.org/t/parsing-a-string-with-quotations/112052)

<div class="topic-metadata">

**Author:** [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Replies:** 5\
**Last updated:** [March 25, 2024, 8:11pm UTC](https://discourse.julialang.org/t/parsing-a-string-with-quotations/112052 "2024-03-25T20:11:47Z")

</div>

I’m writing a small package involving some user interaction in the style of unix command line interactive utilities. The package SimpleArgParse.jl with some adaptations would do the parsing, however it needs to be provid…

---

## [Parsing a vector of vectors with Meta.parse?](https://discourse.julialang.org/t/parsing-a-vector-of-vectors-with-meta-parse/110274)

<div class="topic-metadata">

**Author:** [@Leo\_I](https://discourse.julialang.org/u/Leo_I)\
**Replies:** 12\
**Last updated:** [February 16, 2024, 8:12pm UTC](https://discourse.julialang.org/t/parsing-a-vector-of-vectors-with-meta-parse/110274 "2024-02-16T20:12:44Z")

</div>

I have a concrete problem, where Meta.parse(line) is unbearably slow. My use-case is that I have a long .txt file, in which each line has the form \[x1, ..., xn\], where x1,...,xn are specific integers. I must import/con…

---

## [\[ANN\] Tryparse.jl: Parsing things for you](https://discourse.julialang.org/t/ann-tryparse-jl-parsing-things-for-you/107805)

<div class="topic-metadata">

**Author:** [@thofma](https://discourse.julialang.org/u/thofma)\
**Replies:** 2\
**Last updated:** [December 19, 2023, 9:33am UTC](https://discourse.julialang.org/t/ann-tryparse-jl-parsing-things-for-you/107805 "2023-12-19T09:33:17Z")

</div>

TLDR; With Tryparse.jl you can do julia\> Tryparse.tryparse(Int, "1 + 1") 2 julia\> Tryparse.tryparse(Vector{Int}, "\[1, 2\]") 2-element Vector{Int64}: 1 2 and make things like julia script.jl --opt1="\[1, 2, 3\]" --opt…

---

## [Is this string2range function correct?](https://discourse.julialang.org/t/is-this-string2range-function-correct/106655)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 5\
**Last updated:** [November 24, 2023, 6:18pm UTC](https://discourse.julialang.org/t/is-this-string2range-function-correct/106655 "2023-11-24T18:18:28Z")

</div>

I wrote the following function: function string2range(string\_range) a, b, c = split(string\_range, ':') a1 = parse(Float64, a) b1 = parse(Float64, b) c1 = parse(Float64, c) StepRangeLen(a1, b1, 1+Int6…

---

## [Conversion from string to matrix](https://discourse.julialang.org/t/conversion-from-string-to-matrix/105109)

<div class="topic-metadata">

**Author:** [@dnldlg](https://discourse.julialang.org/u/dnldlg)\
**Replies:** 3\
**Last updated:** [October 18, 2023, 12:15pm UTC](https://discourse.julialang.org/t/conversion-from-string-to-matrix/105109 "2023-10-18T12:15:33Z")

</div>

I saved a complex matrix to a text file, e.g. ComplexF64\[1.0 + 1.0im 1.0 + 0.0im; 5.0 + 0.0im 0.0 + 0.0im\] but struggle to read it again. Is there an easy way to parse this?

---

## [Is there a way to speed up this code?](https://discourse.julialang.org/t/is-there-a-way-to-speed-up-this-code/102878)

<div class="topic-metadata">

**Author:** [@Luis\_Manuel\_Espinoza](https://discourse.julialang.org/u/Luis_Manuel_Espinoza)\
**Replies:** 4\
**Last updated:** [August 16, 2023, 10:09pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-speed-up-this-code/102878 "2023-08-16T22:09:02Z")

</div>

function open\_xyz\_file(path::AbstractString) file = open(path) num\_atoms = parse(Int, readline(file)) comment = readline(file) symbols = Vector{String}(undef, num\_atoms) coords = zeros(num\_atoms,3) for i in 1:num\_a…

---

## [\[ANN\] PikaParser.jl -- small and fast parser library](https://discourse.julialang.org/t/ann-pikaparser-jl-small-and-fast-parser-library/93700)

<div class="topic-metadata">

**Author:** [@MirekKratochvil](https://discourse.julialang.org/u/MirekKratochvil)\
**Replies:** 9\
**Last updated:** [August 5, 2023, 4:44pm UTC](https://discourse.julialang.org/t/ann-pikaparser-jl-small-and-fast-parser-library/93700 "2023-08-05T16:44:21Z")

</div>

It has been around half a year since we released the first version of PikaParser.jl, and we’re at 0.5.1 today successfully using it for several local projects\*. So I thought it’s about time to announce it more formally. …

---

## [How to parse string with non-US number format?](https://discourse.julialang.org/t/how-to-parse-string-with-non-us-number-format/97833)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 1\
**Last updated:** [April 24, 2023, 5:41am UTC](https://discourse.julialang.org/t/how-to-parse-string-with-non-us-number-format/97833 "2023-04-24T05:41:20Z")

</div>

How to convert the string "132.993,00" to the floating point value 132993.00? Are the internationalization or locale packages in Julia that handle country-specific number formats? Base.parse doesn’t contain options to p…

---

## [∪ doesn't parse as expected](https://discourse.julialang.org/t/doesnt-parse-as-expected/97671)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 13\
**Last updated:** [April 20, 2023, 3:26pm UTC](https://discourse.julialang.org/t/doesnt-parse-as-expected/97671 "2023-04-20T15:26:57Z")

</div>

julia\> 1..2 ∪ 3..5 ERROR: syntax: extra token ".." after end of expression Stacktrace: \[1\] top-level scope @ none:1 That’s a bummer. I was hoping to use this syntax inside a macro expansion, but it doesn’t even pars…

---

## [How to parse a string with ranges?](https://discourse.julialang.org/t/how-to-parse-a-string-with-ranges/97288)

<div class="topic-metadata">

**Author:** [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Replies:** 7\
**Last updated:** [April 10, 2023, 4:48am UTC](https://discourse.julialang.org/t/how-to-parse-a-string-with-ranges/97288 "2023-04-10T04:48:31Z")

</div>

I would like to avoid using eval to parse some user input from the REPL that expects lists of integers and may contain some ranges, as in this MWE: # INPUT: str = "1 3:3:12 18 20" # OUTPUT: v = eval(Meta.parse("\[" \* j…

---

## [Recommend a parsing library for LibPQ.jl?](https://discourse.julialang.org/t/recommend-a-parsing-library-for-libpq-jl/96023)

<div class="topic-metadata">

**Author:** [@iamed2](https://discourse.julialang.org/u/iamed2)\
**Replies:** 1\
**Last updated:** [March 13, 2023, 10:14pm UTC](https://discourse.julialang.org/t/recommend-a-parsing-library-for-libpq-jl/96023 "2023-03-13T22:14:47Z")

</div>

I’m looking to improve the parsing code in LibPQ and expand support for more data types. PCRE2 is expensive and heavyweight, but it’s a challenge to write each parser from scratch and I don’t want to reinvent the wheel. …

---

## [Why can't I combine a macro call with a comparison operator?](https://discourse.julialang.org/t/why-cant-i-combine-a-macro-call-with-a-comparison-operator/92493)

<div class="topic-metadata">

**Author:** [@veddox](https://discourse.julialang.org/u/veddox)\
**Replies:** 5\
**Last updated:** [January 5, 2023, 6:13am UTC](https://discourse.julialang.org/t/why-cant-i-combine-a-macro-call-with-a-comparison-operator/92493 "2023-01-05T06:13:37Z")

</div>

To save myself a bit of typing, I have created a wrapper macro around a function in my model, to be used in a specific context: macro landcover() :(landcover($(esc(:pos)), $(esc(:model)))) end I want to be able to …

---

## [Why is the expression \`@foo.x\` parsed as \`macrocall . foo @x\` and not \`macrocall @foo .x\`?](https://discourse.julialang.org/t/why-is-the-expression-foo-x-parsed-as-macrocall-foo-x-and-not-macrocall-foo-x/82218)

<div class="topic-metadata">

**Author:** [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)\
**Replies:** 4\
**Last updated:** [June 19, 2022, 4:46pm UTC](https://discourse.julialang.org/t/why-is-the-expression-foo-x-parsed-as-macrocall-foo-x-and-not-macrocall-foo-x/82218 "2022-06-19T16:46:00Z")

</div>

I know Julia is not at that stage anymore, but i’m curious to know. And just to clarify the macrocall @foo .x, expression, i mean: Expr head: Symbol macrocall args: Array{Any}((2,)) 1: Symbol @foo 2: Expr …

[Next page](https://discourse.julialang.org/tag/parsing/514.md?match_all_tags=true&page=1&tags%5B%5D=parsing)
