Solved

Pattern Match for MAC address

Posted on 2012-03-30
9
612 Views
Last Modified: 2012-04-02
Hi

I have 2 strings:
  00-0F-B7-21-22-44:ess-Mident-Wireless
  00:0F:B7:21:20:A8:ess-Mident-Wireless

How to create a pattern match for them using the rules in: http://technet.microsoft.com/en-us/library/cc755272(WS.10).aspx

Is the following correct?
00\-|\:0F\-|\:B7\-|\:22|0\-|\:4|8:ess-Mident-Wireless

Thanks,

Luchuan
 

Thanks,

Luchuan
0
Comment
Question by:luchuanc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 3

Expert Comment

by:nullsquid
ID: 37789082
is

00\-|\:0F\-|\:B7\-|\:21\-|\:22|0\-|\:4|A4|8:ess-Mident-Wireless

more correct?
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 37789096
how about

([0-9A-F]{2}[:-]){5}ess-Mident-Wireless
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 37789101
I made the assumption you would want to match other hex delimited values ending with 'ess-Mident-Wireless'
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 6

Accepted Solution

by:
theKashyap earned 500 total points
ID: 37789109
I don't think so (21 is missing altogether). Here is more readable version:

00[-:]0F[-:]B7[-:]21[-:]2[20][-:](44|A8):ess-Mident-Wireless

Open in new window


or even more readable:

00[-:]0F[-:]B7[-:]21[-:](20|22)[-:](44|A8):ess-Mident-Wireless

Open in new window

0
 
LVL 6

Expert Comment

by:theKashyap
ID: 37789133
@nullsquid though this NPS regEx syntax is new to me, just thinking abt any regEx engine impl, i wonder how the matcher would figure out the LHS and RHS of an or statement without bounds.

E.g. according to my understanding
00\-|\:0F\-|\:B7\-|\:21\-|\:22|0\-|\:4|A4|8:ess-Mident-Wireless

would match "00-" as well!
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 37789144
00\-|\:0F\-|\:B7\-|\:21\-|\:22|0\-|\:4|A4|8:ess-Mident-Wireless

will also match...

"8:ess-Mident-Wireless"
0
 
LVL 6

Expert Comment

by:theKashyap
ID: 37789157
@sdstuber however stupid this sounds, http://technet.microsoft.com/en-us/library/cc755272%28WS.10%29.aspx doesn't list ranged expressions ([0-9]) as supported!

([0-9A-F]{2}[:-]){5}ess-Mident-Wireless
  ^^^^^^
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 37789176
it doesn't in the character list column but it uses them in the examples so I made the assumption they were supported

For example:

\d   Matches a digit character (equivalent to [0-9]).

if they really aren't supported though (yuck) then change

[0-9A-F]

to

[0123456789ABCDEF]
0
 

Author Comment

by:luchuanc
ID: 37796905
In trying to get these to work I found there is a bug in Windows NPS:

http://support.microsoft.com/kb/2599437

Things only worked after I applied this hotfix.

I also noticed I had incorrectly posted the MACs - both use a "-" as separator not ":"

final code:

00-0F-B7-21-22-44:ess-Mident-Wireless
00-0F-B7-21-20-A8:ess-Mident-Wireless

00[-]0F[-]B7[-]21[-](20|22)[-](44|A8):ess-Mident-Wireless
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Parsing a string to hours of operation 6 227
Australian Method of paying off a mortgage 6 450
how to understand recursion 12 233
Homework Math Question 1 126
One of Google's most recent algorithm changes affecting local searches is entitled "The Pigeon Update." This update has dramatically enhanced search inquires for the keyword "Yelp." Google searches with the word "Yelp" included will now yield Yelp a…
Article by: Nadia
Suppose you use Uber application as a rider and you request a ride to go from one place to another. Your driver just arrived at the parking lot of your place. The only thing you know about the ride is the license plate number. How do you find your U…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question