/* RegExp.prototype */ RegExp.prototype.isRegExp = true; RE = Regexp = RegExp; RegExp.escape = function(str){ return str.replace(/(\\|\[|\]|\(|\)|\{|\}|\^|\-|\$|\||\+|\*|\?|\.|\!)/g,"\\$1"); }; // よく使われる正規表現を高速化 RE.func_body = /\{((:?.|\n)*)\}/; RE.func_name = /function ([\w$]+)/; RE.func_args = /\(([^)]*)/; function MatchData(){ var self = this; this.leftContext = this.pre_match = new LazyString(function(){ return self.input.slice(0,self.index) }); this.rightContext = this.post_match = new LazyString(function(){ return self.input.slice(self.index+self.$0.length) }); return this; } MatchData.prototype.update = function(a){ this.lastMatch = this.$0 = a[0]; this.match = this.captures = []; for(var i=1;i