Fix regeex for ip

This commit is contained in:
Lakindu Akash 2021-12-27 01:56:39 +05:30
parent d1015ed59c
commit c9d2016a07
No known key found for this signature in database
GPG Key ID: 6FB0085A614E0AC2

View File

@ -126,10 +126,8 @@ int isValidIPaddress(const char * ip){
/* Compile regular expression */ /* Compile regular expression */
reti = regcomp(&regex, reti = regcomp(&regex,
"^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))." "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$",
"([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))." REG_EXTENDED);
"([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))."
"([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$", REG_EXTENDED);
if (reti) { if (reti) {
//printf( "Could not compile regex\n"); //printf( "Could not compile regex\n");
return -1; return -1;