js 常用正则表达式
var REGEX_TPL = {}; REGEX_TPL.RORN = /(\r|\n)*/g; REGEX_TPL.SPLIT = /[\r|\n]+/g; REGEX_TPL.IPTEXTFIELD_BLANKREG = /\S +\S/; REGEX_TPL.IPTEXTFIELD_MASKREG = /^\s*".*"\s*$/; REGEX_TPL.IPTEXTFIELD_MASKREG_TWO = /^\s*"[^"]{1,}"\s*$/; REGEX_TPL.IPTEXTFIELD_ALLOWLETTER = /^[a-zA-Z].*/; REGEX_TPL.TEXTFIELD_ALLOWFIRSTLETTER = /^[a-zA-Z0-9].*/; REGEX_TPL.COMP_RMASK = /^1+0*$/; REGEX_TPL.COMP_RREMASK = /^0+1*$/; REGEX_TPL.COMP_RMASK_NOTALLOWBLANK = /^1+0*$/; REGEX_TPL.SYSTEM_INTERFACE_E1_TIMESLOT_RANGE = /^[0-9]*((,[ ]*|-)[0-9]+)*$/; REGEX_TPL.GLOBALNBSP = / /g; REGEX_TPL.EMAIL = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;//邮箱验证 REGEX_TPL.CERT_NAME = /^[a-zA-Z0-9\u4E00-\u9FA5][a-zA-Z0-9\u4E00-\u9FA5-_. ]*$/;//证书名称
var reg=/^((ftp)|(http)|(https)|(mailto)|(file)|(ldap)|(news)|(gopher)|(telnet))\:\/\//;
var re_3 = new RegExp("((?=[\x21-\x7e]+)[^A-Za-z0-9])");
htmlEncode
html.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """)
htmlDecode
html.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, '"')
trim
html.replace(/^\s+|\s+$/g, "")