摘要: 正则转义字符: Table 10-2. Regular expression character classesCharacter Matches[...] Any one character between the brackets.[^...] Any one character not between the brackets.. Any character except newline or another Unicode line terminator.\w Any ASCII word character. Equivalent to [a-zA-Z0-9_].\W Any ch. 阅读全文
posted @ 2013-08-17 20:04 eyotata 阅读(525) 评论(0) 推荐(0) 编辑
摘要: String.prototype.trim = String.prototype.trim || function () {if (!this) return this;//Don't alert the empty string/* this.replace(/^\s+|\s+$/g, "") 和 this.replace(/^\s+/,'').repalce(/\s+$/,'');相比.后者比前者快150ms左右,如果字符串更长可能差距会更大,所以决定使用高效的方法*/this.replace(/^\s+/, '' 阅读全文
posted @ 2013-08-17 19:58 eyotata 阅读(187) 评论(0) 推荐(0) 编辑