* Fixed multiline replace

This commit is contained in:
Ruben Daniels 2012-05-08 21:08:59 -07:00
commit 2d2c326805

View file

@ -173,18 +173,18 @@ Search.SELECTION = 2;
* *
**/ **/
this.replace = function(input, replacement) { this.replace = function(input, replacement) {
if (!this.$options.regExp)
return input == this.$options.needle ? replacement : null;
var re = this.$assembleRegExp(); var re = this.$assembleRegExp();
if (!re) if (!re)
return; return;
var match = re.exec(input); var match = re.exec(input);
if (match && match[0].length == input.length) { if (match && match[0].length == input.length) {
if (this.$options.regExp) { return input.replace(re, replacement);
return input.replace(re, replacement); }
} else { else {
return replacement;
}
} else {
return null; return null;
} }
}; };