Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/348.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/2/image-processing/2.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
Java模式匹配器逗号_Java_Regex_Comma_Matcher - Fatal编程技术网

Java模式匹配器逗号

Java模式匹配器逗号,java,regex,comma,matcher,Java,Regex,Comma,Matcher,我试图对字符串使用模式检查,出于某种原因,它表示不应该匹配的字符串会 代码: 除“1,3”外,上述所有示例均正确。模式不应包含逗号。有人有什么想法吗 你需要避开冲刺 +-/ 否则,它将被解释为从'+'到'/'-一个范围,包括'+',,','-''.和'/' private static final Pattern VALID_TOKEN = Pattern.compile("^[a-zA-Z0-9\\{\\}\\[\\].+\\-/=><\\\\*]*$"); //

我试图对字符串使用模式检查,出于某种原因,它表示不应该匹配的字符串会

代码:


除“1,3”外,上述所有示例均正确。模式不应包含逗号。有人有什么想法吗

你需要避开冲刺

+-/
否则,它将被解释为从
'+'
'/'
-一个范围,包括
'+'
,'
'-'
<代码>'.和
'/'

private static final Pattern VALID_TOKEN = Pattern.compile("^[a-zA-Z0-9\\{\\}\\[\\].+\\-/=><\\\\*]*$");
//                              Here ------------------------------------------------^^
private static final Pattern VALID\u TOKEN=Pattern.compile(“^[a-zA-Z0-9\\{\\\\\\\\\\[\\].+\\-/=>
+-/
private static final Pattern VALID_TOKEN = Pattern.compile("^[a-zA-Z0-9\\{\\}\\[\\].+\\-/=><\\\\*]*$");
//                              Here ------------------------------------------------^^