imho, regexp is overkill here.
as for me, i usually just split line for first '=', then trim
spaces left and right parts.
On Friday, 6 May 2022 at 07:51:01 UTC, Alexander Zhirov wrote:
On Friday, 6 May 2022 at 05:40:52 UTC, forkit wrote:
auto myTuple = line.split(" = ");
Well, only if as a strict form :)
well.. a settings file should be following a strict format.
..otherwise...anything goes... and good luck wi
On Friday, 6 May 2022 at 05:40:52 UTC, forkit wrote:
auto myTuple = line.split(" = ");
Well, only if as a strict form :)
On Thursday, 5 May 2022 at 17:53:57 UTC, Alexander Zhirov wrote:
I want to use a configuration file with external settings. I'm
trying to use regular expressions to read the `Property =
Value` settings. I would like to do it all more beautifully. Is
there any way to get rid of the line break ch
On Thursday, 5 May 2022 at 19:19:26 UTC, Ali Çehreli wrote:
Couldn't help myself from improving. :) The following regex
works in my Linux console. No issues with '\n'. (?) It also
allows for leading and trailing spaces:
import std.regex;
import std.stdio;
import std.algorithm;
import std.array
On 5/5/22 12:05, Alexander Zhirov wrote:
On Thursday, 5 May 2022 at 18:58:41 UTC, H. S. Teoh wrote:
You don't have to. Just add a `$` to the end of your regex, and it
should match the newline. If you put it outside the capture
parentheses, it will not be included in the value.
In fact, it tur
On Thursday, 5 May 2022 at 18:58:41 UTC, H. S. Teoh wrote:
You don't have to. Just add a `$` to the end of your regex, and
it should match the newline. If you put it outside the capture
parentheses, it will not be included in the value.
In fact, it turned out to be much easier. It was just nec
On Thu, May 05, 2022 at 06:50:17PM +, Alexander Zhirov via
Digitalmars-d-learn wrote:
> On Thursday, 5 May 2022 at 18:15:28 UTC, H. S. Teoh wrote:
> > auto m = matchFirst(line, p_property);
>
> Yes, it looks more attractive. Thanks! I just don't quite understand how
> `matchFirst` works.
On Thursday, 5 May 2022 at 18:15:28 UTC, H. S. Teoh wrote:
auto m = matchFirst(line, p_property);
Yes, it looks more attractive. Thanks! I just don't quite
understand how `matchFirst` works. I seem to have read the
[description](https://dlang.org/phobos/std_regex.html#Captures),
but
On Thu, May 05, 2022 at 05:53:57PM +, Alexander Zhirov via
Digitalmars-d-learn wrote:
> I want to use a configuration file with external settings. I'm trying
> to use regular expressions to read the `Property = Value` settings. I
> would like to do it all more beautifully. Is there any way to
I want to use a configuration file with external settings. I'm
trying to use regular expressions to read the `Property = Value`
settings. I would like to do it all more beautifully. Is there
any way to get rid of the line break character? How much does
everything look "right"?
**settings.conf
11 matches
Mail list logo