interface optionsInter { val : any ; length : number ; } interface appointLen { start : number ; end : number ; val : any ; } type interCheck = ( val : any ) => boolean ; type superInterCheck = ( options : optionsInter ) => boolean ; type appointLenInterCheck = ( options : appointLen ) => boolean ; export default class reCheck { public checkPhone : interCheck = ( val ) => /^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/ . test ( val ) ; public checkEmail : interCheck = ( val ) => /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/ . test ( val ) ; public checkUrl : interCheck = ( val ) => /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/ . test ( val ) ; public checkDomesticTelephone : interCheck = ( val ) => /\d{3}-\d{8}|\d{4}-\d{7}/ . test ( val ) ; public checkNotSpecial : appointLenInterCheck = ( options ) => new RegExp ( '^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{' + options . start + ',' + options . end + '}$' ) . test ( options . val ) ; public checkHtml : interCheck = ( val ) => new RegExp ( '<(\\S*?)[^>]*>.*?</\\1>|<.*? />' ) . test ( val ) ; public checkQQ : interCheck = ( val ) => /[1-9][0-9]{4,}/ . test ( val ) ; public checkPostOffice : interCheck = ( val ) => /[1-9]\d{5}(?!\d)/ . test ( val ) ; public checkDateFormat : interCheck = ( val ) => /^\d{4}-\d{1,2}-\d{1,2}/ . test ( val ) ; public checkLowerCase : interCheck = ( val ) => /^[a-z]+$/ . test ( val ) ; public checkUpperCase : interCheck = ( val ) => /^[A-Z]+$/ . test ( val ) ; public checkAlphabets : interCheck = ( val ) => /^[A-Za-z]+$/ . test ( val ) ; public checkCID : interCheck = ( val ) => /^\d{15}|\d{18}$/ . test ( val ) ; public checkPasswordSpecification : appointLenInterCheck = ( options ) => new RegExp ( '^[a-zA-Z]\\w{' + options . start + ',' + options . end + '}$' ) . test ( options . val ) ; public checkDChineseCharacterDetection : interCheck = ( val ) => /^[\u4e00-\u9fa5]*$/ . test ( val ) ; public checkNumberUnderscoreletter : interCheck = ( val ) => /^\w+$/ . test ( val ) ; public checkChineseNumberEnglishUnderline : interCheck = ( val ) => /^[\u4E00-\u9FA5A-Za-z0-9_]+$/ . test ( val ) ; public checkSpecialCharacters : interCheck = ( val ) => /^[\u4E00-\u9FA5A-Za-z0-9]+$/ . test ( val ) ; public checkStrComposedOfNumber : interCheck = ( val ) => /^[0-9]+.?[0-9]*$/ . test ( val ) ; public checkNumberLength : superInterCheck = ( options ) => new RegExp ( "^\\d{" + options . length + "}$" ) . test ( options . val ) ; public checkAppointLen : appointLenInterCheck = ( options ) => new RegExp ( "^\\d{" + options . start + ',' + options . end + "}$" ) . test ( options . val ) ; public checkZeroAndNonZero : interCheck = ( val ) => /^(0|[1-9][0-9]*)$/ . test ( val ) ; public checkTwoDecimalplaces : interCheck = ( val ) => /^([1-9][0-9]*)+(.[0-9]{1,2})?$/ . test ( val ) ; public checkDecimalplaces : interCheck = ( val ) => /^(\-)?\d+(\.\d{1,2})?$/ . test ( val ) ; public checkPND : interCheck = ( val ) => /^(\-|\+)?\d+(\.\d+)?$/ . test ( val ) ; public checkPositiveTDP : interCheck = ( val ) => /^[0-9]+(.[0-9]{2})?$/ . test ( val ) ; public checkOandTPositive : interCheck = ( val ) => /^[0-9]+(.[0-9]{1,3})?$/ . test ( val ) ; public checkNonzeroPositive : interCheck = ( val ) => /^[1-9]\d*/ . test ( val ) ; public checkNonzeroNegative : interCheck = ( val ) => /^-[1-9]\d*$/ . test ( val ) ; public checkNotNegative : interCheck = ( val ) => /^\d+$/ . test ( val ) ; public checkNotPositive : interCheck = ( val ) => /^-[1-9]\d*|0$/ . test ( val ) ; public checkNotNegativeFloat : interCheck = ( val ) => /^\d+(\.\d+)?$/ . test ( val ) ; public checkNotPositiveFloat : interCheck = ( val ) => /^((-\d+(\.\d+)?)|(0+(\.0+)?))$/ . test ( val ) ; public checkPositiveFloat : interCheck = ( val ) => /^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$/ . test ( val ) ; public checkNegativeFloat : interCheck = ( val ) => /^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$/ . test ( val ) ; public checkFloat : interCheck = ( val ) => /^(-?\d+)(\.\d+)?$/ . test ( val ) ; }