Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在不允许特殊字符的文本框中允许日文文本_C#_Regex_Wpf - Fatal编程技术网

C# 如何在不允许特殊字符的文本框中允许日文文本

C# 如何在不允许特殊字符的文本框中允许日文文本,c#,regex,wpf,C#,Regex,Wpf,我有一个带有文本框字段的注册表,一些文本字段不允许使用特殊字符,我想使用日语字符。但是不允许特殊字符的文本框也不允许日文文本。那么如何允许日语呢。我正在使用正则表达式验证文本框 我的代码在这里: private Regex emailRegex = new Regex(@"^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$"); private Regex phnRegex = new Regex(@"^[0-9]+$"

我有一个带有文本框字段的注册表,一些文本字段不允许使用特殊字符,我想使用日语字符。但是不允许特殊字符的文本框也不允许日文文本。那么如何允许日语呢。我正在使用正则表达式验证文本框

我的代码在这里:

private Regex emailRegex = new Regex(@"^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$");
private Regex phnRegex = new Regex(@"^[0-9]+$");
private Regex nameRegex = new Regex(@"^[a-zA-Z\ ]+$");
private Regex cmpnRegex = new Regex(@"^[a-zA-Z\ \.\,\(\)]+$");        
正则表达式:

\p{L}

匹配任何语言中的所有字母。没有特殊字符。

您不需要转义字符类中的
,()。
符号。你知道你的正则表达式是做什么的吗?