Skip to content

Commit

Permalink
Merge pull request dlang-jp#149 from kubo39/regex-greedy-or-lazy
Browse files Browse the repository at this point in the history
正規表現: 最小量指定子の説明追加
  • Loading branch information
kubo39 committed Jan 26, 2022
2 parents 34a51c5 + ef36ec5 commit 8c45526
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source/regex_example.d
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ module regex_example;
assert(capt[3] == "1");
assert(capt[4] == "255");
}

// 繰り返しの最小量指定子もサポートしています。
auto s = "Ubuntu(Linux)/Debian(Linux)/FreeBSD(BSD)";
assert(s.matchFirst(regex(`\w+\(.*\)`)).hit == s);
assert(s.matchFirst(regex(`\w+\(.*?\)`)).hit == "Ubuntu(Linux)");
}

/++
Expand Down

0 comments on commit 8c45526

Please sign in to comment.