https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions
replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
| var __extends = this.__extends || function (d, b) { | |
| for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
| function __() { this.constructor = d; } | |
| __.prototype = b.prototype; | |
| d.prototype = new __(); | |
| }; |
| window.foo = window.foo || {}; // this.foo = this.foo || {}; | |
| foo.bar = foo.bar || {}; | |
| foo.bar.baz = foo.bar.baz || {}; |
| (function(a) { | |
| var b = a / Math.abs(a); | |
| if (b === 1 || b === -1) | |
| return b; | |
| return 1; | |
| })(0); |
| (function (w, r) { | |
| w['r'+r] = w['r'+r] || w['webkitR'+r] || w['mozR'+r] || w['msR'+r] || w['oR'+r] || function (c) { w.setTimeout(c, 1000 / 60); }; | |
| })(window, 'equestAnimationFrame'); |
| var content = "@abc@def @abc @あ @あ @あ abcdefghijklmnopqrstuvwxyz @bcd\n@cde @ a @aaa@bbb @cde"; | |
| var matches = content.match(/@[^\s]+/g); | |
| for (var i = 0; i < matches.length; i++) { | |
| var count = matches[i].match(/@/g); | |
| if (count.length == 1) { | |
| var regex = new RegExp('(^|\\s)' + matches[i] + '(\\s|$)'); | |
| content = content.replace(regex, "$1" + matches[i] + "[objecId:" + i + "]$2"); | |
| } | |
| } |
https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions
replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
| var now = new Date(); | |
| var today = new Date(new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0).getTime()); |