Skip to content

Commit 8c45526

Browse files
authored
Merge pull request dlang-jp#149 from kubo39/regex-greedy-or-lazy
正規表現: 最小量指定子の説明追加
2 parents 34a51c5 + ef36ec5 commit 8c45526

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

source/regex_example.d

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ module regex_example;
131131
assert(capt[3] == "1");
132132
assert(capt[4] == "255");
133133
}
134+
135+
// 繰り返しの最小量指定子もサポートしています。
136+
auto s = "Ubuntu(Linux)/Debian(Linux)/FreeBSD(BSD)";
137+
assert(s.matchFirst(regex(`\w+\(.*\)`)).hit == s);
138+
assert(s.matchFirst(regex(`\w+\(.*?\)`)).hit == "Ubuntu(Linux)");
134139
}
135140

136141
/++

0 commit comments

Comments
 (0)