Using regular expressions when reading a file

Alexander Zhirov azhirov1991 at gmail.com
Thu May 5 19:05:43 UTC 2022


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 necessary 
to use the `m` flag instead of the `s` flag:

```d
auto p_property = regex(r"^(\w+) *= *(.+)", "m");
```



More information about the Digitalmars-d-learn mailing list