mortido,
var reg = /\b(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])(\s*\-\s*)(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])\b/;
var str = "31.173.80.0 - 31.173.87.255"
alert(reg.test(str));//true
str = "31.17300.80.0 - 31.173.87.255"
alert(reg.test(str));//false
RegExp for matching Decimal IP