I would like to know the correct regex for matching multiple MAC addresses separated my any delimiter, such as a comma.
The regex for a single MAC address would be: ^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}$
.
So for multiple MAC addresses delimited by comma, i figured ^(([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2},?)){+}$
would do the trick.
Where am i going wrong? Any help would be appreciated, thanks.
Edit: Some people have asked about what went wrong. Well, simply put, the regex does not work. Let us say i enter a single (valid) MAC address, it is flagged as an invalid MAC address. Same goes for multiple MAC addresses delimited by comma.
The regex is needed for a validator for a textbox on an ASP .NET page. If more details are needed, let me know.