This is something I've searched on the forum and couldn't find exact answer.

TLDR: `r"^."` is matching the very first two character in the `input` string.

**matchtest.d**
```
import std.stdio : writeln;
import std.regex : matchAll;
import std.file  : read;

void main(){

        string input = cast(string)read("example.txt");
        writeln(matchAll(input, r"^."));

}
```

**Input(example.txt)**
```
HelloWorld
```

**Output**
```
rdmd matchtest.d
[["He"]]
```

https://dlang.org/phobos/std_regex.html#matchAll
https://dlang.org/library/std/file/read.html

Reply via email to