c - POSIX regex not compiling -


I have this code to match the IP address pattern. But it does not seem to work and I do not know why it always prints "no matches" at the terminal

  regex_t regex; Int rate; Four messagebuffs [100]; Reti = regcomp (and regex, "^ ([0- 9] {1,3}). ([0- 9] {1,3}). ([0- 9] {1,3}). ([ 0- 9] {1,3}) $ ", 0); If (reti) {FPintiff (stadder, "Reggae could not be compiled \ n"); Exit (1); } Reti = regexec (and regex, "124.168.21.3", 0, zero, 0); If (! Reti) {puts ("match"); } And if (reti == REG_NOMATCH) {puts ("no match"); } {Terror (reti, and regex, msgbuf, sizeof (msgbuf)); Fprintf (stderr, "Reggae match failed:% s \ n", msgbuf); Exit (1); } Regfree (& amp; regex);   

Any ideas?

I found, in fact I should specify the seam of the function field REG_EXTENDED and not 0.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -