RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

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
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

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(&regex, "((\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(&regex, "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(&regex, "((\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(&regex, "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 ?


Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials