//regular expressions var reZIP = /^\d{5}$|^[a-zA-Z]\d[a-zA-Z]\s?\d[a-zA-Z]\d$/i ; //US 12345 or Canada A1B 2C3 var rePartySize = /^\d{1,3}$/i ; var reNumericPos = /^\d+$/i ; var reState = /^[A-Za-z]{2}$/i ; var rePhone = /\d{3}\D*\d{3,}\D*\d{4}/i ; var reTaxID = /^[\d-]{9,12}$/i ; var reAlphaNumUnd = /^\w+$/i ; //alphanumeric plus underscore var reActCode = /^[\w-]+$/i ; //alphanumeric plus underscore and hyphen var reActName = /^[\w\(\)\/\,\:\.\s\+-]+$/i ; //alphanumeric plus space, hyphen, comma, underscore, slash, period, colon, single quote, and parentheses var reAlphaNumUndSpace = /^[A-Za-z0-9_\s-]+$/i ; //alphanumeric plus space, underscore, and hyphen var reSearchString = /^[\w-@]+$/i ; //alphanumeric plus underscore, @, and hyphen var reDate = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/i ; var reDateTime = /^\d{4}\-\d{1,2}\-\d{1,2}\s+\d{1,2}:\d{1,2}:\d{1,2}\s?[APM]{0,2}$/i ; //both 2011-11-01 13:35:20 or 2011-11-1 1:35:20 PM var reCCNum = /^\d{15,16}$/i ; var reCCExp = /^\d{4}$/i ; var reCCCVV = /^\d{3,4}$/i ; var reIPaddr = /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[0-9A-F\:]+)$/i ; var rePriceString = /^\d{0,5}\.\d{2}$/i ; var rePriceString2 = /^\d{1,5}\.?\d{0,2}$|^\d{0,5}\.?\d{1,2}$/i ; //allows situations of 4 or .35 or 4.35 var rePriceString3 = /^-?\d{0,5}\.?\d{0,2}$/i ; //allows negative numbers var reCashDrawer = /^[A-Z]{3}\d{2}$/i ; var reLowerCase = /^[a-z]+$/i ; //lower-case letters var reURL = /^[\w\/_\.\#\=\?-]+$/i ; var rePaddleMiles = /^(\d{1,2}).*?(\d{0,2})$/ ; //6 or 8to10 var reTrack1 = /%(B\d{15,19}\^[\w\s\/]{2,26}\^\d{7}\w*)\?/ ; //credit card track 2 data in the format %B4246777788889999^SMITH/JOHN J ^1207100100001100000000051000000?;4246 (final ;4246 begins Track2 and CC number) var reTrack2 = /\;(\d{15,19}\=\w+?)\?/ ; //credit card track 2 data in the format ;4011027788889999=110501110000268? //regular expressions of prohibited characters and keywords var reBad = new Array() ; reBad[0] = /[\&'`":;\{\}\(\)=]/i ; reBad[1] = /[<>]/i ; reBad[2] = /\&\#/i ; var zx = 3 ; reBad[zx] = /<\s*\/?\s*SCRIPT/i ; zx++ ; //javascript