回答編集履歴
1
説明追加
answer
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
```C#
|
2
2
|
var str = @"^[0-9a-z@+?]+$";
|
3
3
|
bool res = Regex.IsMatch("#azd@+", str);
|
4
|
-
```
|
4
|
+
```
|
5
|
+
|
6
|
+
[IsMatch(String, String)](https://docs.microsoft.com/ja-jp/dotnet/api/system.text.regularexpressions.regex.ismatch#System_Text_RegularExpressions_Regex_IsMatch_System_String_System_String_)
|
7
|
+
正規表現と一致する箇所が見つかった場合に`true`が返るので、`^`と`$`をつけて先頭から末尾まで、`+`をつけて複数文字にマッチさせないと意図通りになっていません。
|