Title |
Test
Find
Pattern Title
|
Expression |
((\d|([a-f]|[A-F])){2}:){5}(\d|([a-f]|[A-F])){2} |
Description |
Deisgned to verify a MAC address with hex values seperated by a colon. |
Matches |
00:00:39:F9:3C:59 | 00:90:83:6A:B3:B7 | 00:00:39:59:30:5C |
Non-Matches |
00:0H:39:59:30:5C | 00:39:59:30:5C | 00:39:59:30:5C:BZ |
Author |
Rating:
Not yet rated.
Jason Jenisch
|
Source |
|
Your Rating |
|
Title: What is \d. Failed to get the match for MAC.
Name: Priyanka
Date: 9/18/2012 4:03:06 PM
Comment:
mac.c: In function ‘main’:
mac.c:22:13: warning: unknown escape sequence: '\d' [enabled by default]
mac.c:22:13: warning: unknown escape sequence: '\d' [enabled by default]
Piece of Code:
reti = regcomp(®ex,
"((\d|([a-f][A-F])){2}:){5}(\d|([a-f][A-F])){2}", 0);
if (reti)
{
printf(" Error in regex compile \n");
exit(1);
}
reti = regexec(®ex, "00:12:34:56:67:ab", 0, NULL, 0);
if (!reti)
{
printf("Match\n");
}
else if ( reti == REG_NOMATCH)
{
printf(" No match \n");
}
I am getting the result as NO MATCH. Why ?
Title: What is \d
Name: Priyanka
Date: 9/18/2012 4:02:20 PM
Comment:
mac.c: In function ‘main’:
mac.c:22:13: warning: unknown escape sequence: '\d' [enabled by default]
mac.c:22:13: warning: unknown escape sequence: '\d' [enabled by default]
Piece of Code:
reti = regcomp(®ex,
"((\d|([a-f][A-F])){2}:){5}(\d|([a-f][A-F])){2}", 0);
if (reti)
{
printf(" Error in regex compile \n");
exit(1);
}
reti = regexec(®ex, "00:12:34:56:67:ab", 0, NULL, 0);
if (!reti)
{
printf("Match\n");
}
else if ( reti == REG_NOMATCH)
{
printf(" No match \n");
}
I am getting the result as NO MATCH. Why ?