wb:// var wh = wb.getFindInfo().where; var s = 'score > 0'; var e = new RegExp(s,'i'); if( wh.search(e) != -1 ){ s = wh.replace(s,''); }else{ if( wh.length > 0 ){ s = wh+' and '+s; } } s = s.replace(/ +and *$/i,''); s = s.replace(/^ *and +/i,''); wb.addWhere(s);