frostbelt

 

package check
{
	import mx.events.ValidationResultEvent;
	import mx.validators.RegExpValidator;
	
	public class Check
	{
		var regExpValidator:RegExpValidator=new RegExpValidator;
		
		public function is_Ip(ip:Object):Boolean{
			var result:Boolean=true;
			this.regExpValidator.property="text";
			this.regExpValidator.source=ip;
			this.regExpValidator.expression="^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]{1}|0[1-9]{1}[0-9]{1}|00[1-9]{1})\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]{1}|0[1-9]{1}[0-9]{1}|00[1-9]{1}|0)\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]{1}|0[1-9]{1}[0-9]{1}|00[1-9]{1}|0)\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]{1}|0[1-9]{1}[0-9]{1}|00[1-9]{1}|0)$";
			this.regExpValidator.noMatchError="格式错误";
			
			var event:ValidationResultEvent=this.regExpValidator.validate();
			if(event.type==ValidationResultEvent.INVALID){
				result=false;
			}
			return result;
		}

	}
}

 

分类:

技术点:

相关文章:

  • 2021-12-07
  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2020-06-05
  • 2022-12-23
  • 2021-10-14
  • 2022-12-23
相关资源
相似解决方案