rem: searchStr = searchStr.replace( /^\s+/, "" ); searchStr = searchStr.replace(/(\n|\r|\t)+/g, " "); searchStr = searchStr.replace(/\s+$/,""); 
add:  if (!charlen) charlen = 150; if (charlen < searchStr.length) {  var pattern = new RegExp("^(?:\\s*.){0," + charlen + "}"); pattern.test(searchStr); searchStr = RegExp.lastMatch; } searchStr = searchStr.replace(/\s*(.*?)\s*$/, "$1"); searchStr = searchStr.replace(/\s+/g, " "); 
context:     searchSelected : function() {        var focusedWindow = document.commandDispatcher.focusedWindow;        var searchStr = focusedWindow.__proto__.getSelection.call(focusedWindow);        searchStr = searchStr.toString();        searchStr = searchStr.replace( /^\s+/, "" );        searchStr = searchStr.replace(/(\n|\r|\t)+/g, " ");        searchStr = searchStr.replace(/\s+$/,"");        return searchStr;    },
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/0300557bb801cbfee42504fb6602f47c938c7054/browser.js/buggy/browser/base/content/browser.js