Commit 0aa192f7 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug 32795

symbol '.' in find-replace string value
parent a7f33a1f
...@@ -11028,38 +11028,37 @@ ...@@ -11028,38 +11028,37 @@
return this._replaceCellsText( aReplaceCells, options, lockDraw, callback ); return this._replaceCellsText( aReplaceCells, options, lockDraw, callback );
}; };
WorksheetView.prototype._replaceCellsText = function ( aReplaceCells, options, lockDraw, callback ) { WorksheetView.prototype._replaceCellsText = function (aReplaceCells, options, lockDraw, callback) {
var t = this; var t = this;
var findFlags = "g"; // Заменяем все вхождения var findFlags = "g"; // Заменяем все вхождения
if ( true !== options.isMatchCase ) { if (true !== options.isMatchCase) {
findFlags += "i"; findFlags += "i";
} // Не чувствителен к регистру } // Не чувствителен к регистру
var valueForSearching = options.findWhat var valueForSearching = options.findWhat
.replace( /(\\)/g, "\\\\" ).replace( /(\^)/g, "\\^" ) .replace(/(\\)/g, "\\\\").replace(/(\^)/g, "\\^")
.replace( /(\()/g, "\\(" ).replace( /(\))/g, "\\)" ) .replace(/(\()/g, "\\(").replace(/(\))/g, "\\)")
.replace( /(\+)/g, "\\+" ).replace( /(\[)/g, "\\[" ) .replace(/(\+)/g, "\\+").replace(/(\[)/g, "\\[")
.replace( /(\])/g, "\\]" ).replace( /(\{)/g, "\\{" ) .replace(/(\])/g, "\\]").replace(/(\{)/g, "\\{")
.replace( /(\})/g, "\\}" ).replace( /(\$)/g, "\\$" ) .replace(/(\})/g, "\\}").replace(/(\$)/g, "\\$")
.replace( /(~)?\*/g, function ( $0, $1 ) { .replace(/(~)?\*/g, function ($0, $1) {
return $1 ? $0 : '(.*)'; return $1 ? $0 : '(.*)';
} ) })
.replace( /(~)?\?/g, function ( $0, $1 ) { .replace(/(~)?\?/g, function ($0, $1) {
return $1 ? $0 : '.'; return $1 ? $0 : '.';
} ) })
.replace( /(~\*)/g, "\\*" ).replace( /(~\?)/g, "\\?" ); .replace(/(~\*)/g, "\\*").replace(/(~\?)/g, "\\?").replace(/(\.)/g, "\\.");
valueForSearching = new RegExp( valueForSearching, findFlags ); valueForSearching = new RegExp(valueForSearching, findFlags);
options.indexInArray = 0; options.indexInArray = 0;
options.countFind = aReplaceCells.length; options.countFind = aReplaceCells.length;
options.countReplace = 0; options.countReplace = 0;
if ( options.isReplaceAll && false === this.collaborativeEditing.getCollaborativeEditing() ) { if (options.isReplaceAll && false === this.collaborativeEditing.getCollaborativeEditing()) {
this._isLockedCells( aReplaceCells, /*subType*/null, function () { this._isLockedCells(aReplaceCells, /*subType*/null, function () {
t._replaceCellText( aReplaceCells, valueForSearching, options, lockDraw, callback, true ); t._replaceCellText(aReplaceCells, valueForSearching, options, lockDraw, callback, true);
} ); });
} } else {
else { this._replaceCellText(aReplaceCells, valueForSearching, options, lockDraw, callback, false);
this._replaceCellText( aReplaceCells, valueForSearching, options, lockDraw, callback, false );
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment