Stack Exchange
regex c part of IP
How write regular expression?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <regex.h>
int main () {
regex_t regex;
int reti;
char msgbuf[100];
const char *regIp = "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){1,3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?){0,1}$";
reti = regcomp(&regex, regIp, 0);
regerror(reti, &regex, msgbuf, sizeof(msgbuf));
printf("Regex compile: %s.", msgbuf);
reti = regexec(&regex, "192.168.100", 0, NULL, 0);
if (!reti){
    puts("MUTCH!!");
    } else if (reti == REG_NOMATCH) {
    puts("No mutch");
    } else {
    regerror(reti, &regex, msgbuf, sizeof(msgbuf));
    printf("Regex match failed: %s.", msgbuf);
    }
}

I have No mutch .
I try mask braces, as
^\\(?:\\(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?\\)\\.\\)\\{1,3\\}\\(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?\\)\\{0,1\\}$

But not matches again.
Thanks advance. 

You need to pass REG_EXTENDED to the regcomp method and escape the dot with 2 backslashes.

I put 1 instead of REG_EXTENDED and got Segmentation fault

See https://ideone.com/cuQNbS. I forgot: you must replace non-capturing groups with capturing ones since POSIX regex does not support non-capturing groups.

Use REG_EXTENDED with regcomp and double the backslash before ..
Replace the two lines with regIp initialization and reti assignment in your code with
const char *regIp = "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?\\.){1,3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)?$";
reti = regcomp(&regex, regIp, REG_EXTENDED);
// => Regex compile: Success.MATCH!!

See the C demo
With REG_EXTENDED, POSIX ERE syntax will be allowed in the pattern (so that {m,n} quantifier could be used without escaping the curly braces), and it will also allow the use of $. The literal regex escape \ must be defined with a double backslash in a C string literal.
Note that you must replace non-capturing groups with capturing ones since POSIX regex does not support non-capturing groups. So, all (?:...) should be turned into (...).

Thanks!! It's work for me!
A special thank you for the clarification!
