xxxxxxxxxx
here there are some regular expressions that may help you recognise ip addresses:
binary format (separated by the '.'):
"([01]{8}.){3}[01]{8}"gsxi
decimal format (separated by the '.'):
"(([01][0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}[01][0-9][0-9]|2[0-4][0-9]|25[0-5]"gsxi
xxxxxxxxxx
# Match between 1 to 3 numbers separated by . in four groups
[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}
xxxxxxxxxx
Best for Now (43 chars)
^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$
This version shortens things by another 6 characters while
not making use of the negative lookahead, which is not
supported in some regex flavors.