如何用正则表达式,判断文本框中输入的是IP地址


怎么用正则表达式,判断文本框中输入的是IP地址
标准的IP地址是192.168.0.1,


能不能通过正则表达式判断,文本框中有4个".",而且"."中都是不大于256的数字?



java J2EE 程序开发

真名寺瑜伽 12 years, 6 months ago

2[0-4][0-9]

秀吉我的菜 answered 12 years, 6 months ago

[01] [0-9][0-9] ).){3}( :25[0-5]

其实我是外国人 answered 12 years, 6 months ago

\d{1,2})/;

ip = textvalue;

if (!ipRegEXP.exec(ip)){

            alert("ip格式不对!");<br />

}

邻居的耳朵 answered 12 years, 6 months ago

1\d{0,2}

mashan answered 12 years, 6 months ago

2[0-4]\d

RyoYL answered 12 years, 6 months ago

\d{1,2}).){2}(25[0-5]

游戏X黑魔导 answered 12 years, 6 months ago

1\d{0,2}

相对论对相 answered 12 years, 6 months ago

2[0-4]\d

YiZuKa answered 12 years, 6 months ago

[1-9]\d ).( :( :25[0-5]

Millet_ answered 12 years, 6 months ago

1\d{0,2}

炮姐控496 answered 12 years, 6 months ago

2[0-4]\d

悠逸yui answered 12 years, 6 months ago

[01] [0-9][0-9] )$/)){

alert("success");<br />

}else{

alert("error");<br />

}



永远D风雅 answered 12 years, 6 months ago

var ipRegEXP = /^(25[0-5]

鸡神坐上00 answered 12 years, 6 months ago

Your Answer