can anyone suggest me the regular expression for ip address and mac address ?
i am using python & django
for example , http://[ipaddress]/SaveData/127.0.
You can use /^([0-2]?\d{0,2}\.){3}([0-2]?\d{0,2})$/
for IPv4 Address and /^([\da-fA-F]{1,4}:){7}([\da-fA-F]{1,4})$/i
for IPv6 address.
You can combine these two as /^((([0-2]?\d{0,2}\.){3}([0-2]?\d{0,2}))|(([\da-fA-F]{1,4}:){7}([\da-fA-F]{1,4})))$/i
. You can find a sample here.
Ref: http://snipplr.com/view/49994/ipv4-regex/, http://snipplr.com/view/49993/ipv6-regex/
For Mac Address You can use /^([0-9A-F]{2}[-:]){5}[0-9A-F]{2}$/i
. You can find a sample here.