Reputation: 1169
I am writing a program to read in data from an excel sheet which contains a bunch of info about computers which will be entered by the user. This excel file will then be converted to a different format for other uses. I can read all the values no problem but I just need help validating MAC and IP addresses entered by the user to make sure the information is correct. Some regular expressions for this would be great as I am sure I would use them again at some stage.
Thanks.
Upvotes: 0
Views: 4510
Reputation: 341
"^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"
Upvotes: 1