Re: Help with Regular Expressions (std.regex)

2019-03-05 Thread Samir via Digitalmars-d-learn
On Monday, 4 March 2019 at 18:57:34 UTC, dwdv wrote: There is also std.file.slurp which makes this quite easy: slurp!(int, int, int, int, int)("03.input", "#%d @ %d,%d: %dx%d"); That's brilliant! This language just keeps putting a smile on my face every time I learn something new like this!

Re: Help with Regular Expressions (std.regex)

2019-03-04 Thread dwdv via Digitalmars-d-learn
On 3/3/19 7:07 PM, Samir via Digitalmars-d-learn wrote: I am belatedly working my way through the 2018 edition of the Advent of Code[1] programming challenges using D and am stumped on Problem 3[2]. The challenge requires you to parse a set of lines in the format: #99 @ 652,39: 24x23 #100 @

Re: Help with Regular Expressions (std.regex)

2019-03-04 Thread Samir via Digitalmars-d-learn
On Sunday, 3 March 2019 at 19:27:17 UTC, user1234 wrote: oops forgot the bang auto allMatches = matchAll(line, pattern).map!(a => a.hit).array; Thanks, user1234! Looks like `map` is another topic I need to read up upon. I slightly modified your suggestion and went with: auto

Re: Help with Regular Expressions (std.regex)

2019-03-03 Thread user1234 via Digitalmars-d-learn
On Sunday, 3 March 2019 at 18:32:14 UTC, user1234 wrote: On Sunday, 3 March 2019 at 18:07:57 UTC, Samir wrote: or // sorry i don't have the regex API in mind import std.array: array; import std.alogrithm.iteration : map; auto allMatches = matchAll(line, pattern).map(a => a.hit).array;

Re: Help with Regular Expressions (std.regex)

2019-03-03 Thread user1234 via Digitalmars-d-learn
On Sunday, 3 March 2019 at 18:07:57 UTC, Samir wrote: I am belatedly working my way through the 2018 edition of the Advent of Code[1] programming challenges using D and am stumped on Problem 3[2]. The challenge requires you to parse a set of lines in the format: #99 @ 652,39: 24x23 #100 @

Help with Regular Expressions (std.regex)

2019-03-03 Thread Samir via Digitalmars-d-learn
I am belatedly working my way through the 2018 edition of the Advent of Code[1] programming challenges using D and am stumped on Problem 3[2]. The challenge requires you to parse a set of lines in the format: #99 @ 652,39: 24x23 #100 @ 61,13: 15x24 #101 @ 31,646: 16x28 I would like to store