0
我使用SLRE(https://code.google.com/p/slre/)SLRE正则表达式将无法正常工作
我检查15串在这样不同的正则表达式:
struct slre slre;
struct cap captures[4 + 1];
int i = 0;
int numberOfSettings = 15;
for (i; i < numberOfSettings; i++) {
if (!slre_compile(&slre, settings[i].regex)) {
printf("Error compiling RE: %s\n", slre.err_str);
}
else if (!slre_match(&slre, settings[i].value, strlen(settings[i].value), captures)) {
printf("\nSetting '%s' does not match the regular expression!", settings[i].internName);
}
}
我使用正则表达式(settings[i].regex
)用于解析的IP地址是:
^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])[.]){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
用于检查(settings[i].value
)的值是8.8.8.8
我在JavaScript中也使用了相同的正则表达式,它们按预期工作。
有没有人有一个想法,为什么这会返回false?
大声笑,我可能已经发现,太... ^^谢谢!顺便说一句,我现在使用了系统库regex.h。 – kaljak