Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/56.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/16.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/1/typescript/9.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';s regexec匹配';1111111';至'^[0-9]\{1,3\\.[0-9]\{1,3\\\.[0-9]\{1,3\\\.[0-9]\{1,3\}$&&x27;_C_Regex - Fatal编程技术网

C';s regexec匹配';1111111';至'^[0-9]\{1,3\\.[0-9]\{1,3\\\.[0-9]\{1,3\\\.[0-9]\{1,3\}$&&x27;

C';s regexec匹配';1111111';至'^[0-9]\{1,3\\.[0-9]\{1,3\\\.[0-9]\{1,3\\\.[0-9]\{1,3\}$&&x27;,c,regex,C,Regex,以下代码是我为一个更大项目的一部分编写的独立测试代码;它应该检测四方形式的IPv4地址(由句点分隔的四到三位数字): 它还匹配更长的字符串;我还没过十点。你有逃跑的问题: "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$" 此时,你有一次逃离了你的圆点,这使它们变成了圆点(regex圆点类型)。此外,您不需要转义大括号。您认为反斜杠在C字符串中起什么作用?您仍然没有转义第一个 $ [name of compiled file] comp

以下代码是我为一个更大项目的一部分编写的独立测试代码;它应该检测四方形式的IPv4地址(由句点分隔的四到三位数字):


它还匹配更长的字符串;我还没过十点。

你有逃跑的问题:

"^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$"

此时,你有一次逃离了你的圆点,这使它们变成了圆点(regex圆点类型)。此外,您不需要转义大括号。

您认为反斜杠在C字符串中起什么作用?您仍然没有转义第一个
$ [name of compiled file]
comp
11111111
y
$ 
"^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$"