teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

ソース修正

2021/09/05 02:05

投稿

退会済みユーザー
answer CHANGED
@@ -34,4 +34,16 @@
34
34
  Console.WriteLine(Program.check("xAA99")); // 5文字以上、数字とアルファベットを含み、同じ文字の繰り返しは3回未満なのでsuccess
35
35
  }
36
36
  }
37
- ```
37
+ ```
38
+
39
+ ほんで、上のコードの `check(string text)` を詰めて書くと、こないな感じ
40
+ ```C#
41
+ private static string check(string text) {
42
+ return (
43
+ text.Length >= 5 &&
44
+ Regex.IsMatch(text, "[a-zA-Z]") &&
45
+ Regex.IsMatch(text, "[0-9]") &&
46
+ !Regex.IsMatch(text, "(.)\1{2,}") ? "success" : "fail");
47
+ }
48
+ ```
49
+ ➡ [ここにも上げといたで。](https://replit.com/@suwmn50799/357814Si-Wei-toiebaSi-Wei-Cong-rubinoZhi-Lun)