Changeset 767

Show
Ignore:
Timestamp:
01/17/07 13:10:51
Author:
piv
Message:

fixed bug with strip method and with unicode characters
x

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qSEOptimizer/branches/js-statistics/skins/qSEOptimizer/statistics.js.dtml

    r766 r767  
    4545    if (len != 0) { 
    4646        data = data // replace all non-word character with space 
    47                    .replace(/[^a-zA-Z0-9\-\']+/g, ' ') 
     47                   .replace(/[^a-zA-Z0-9\-\'\u2019\"\`]+/g, ' ') 
    4848                    // replace "-" and "'" symbols if it create groups event inside of token 
    49                    .replace(/[\-\']{2,}/g, ' ') 
     49                   .replace(/[\-\'\u2019\"\`]{2,}/g, ' ') 
    5050                    // replace all non-word characters and "-", "'" if it stay at word edge 
    51                    .replace(/(?:^|\s+)[^a-zA-Z0-9]+|[^a-zA-Z0-9]+(?:\s+|$)/g, ' '); 
    52         var data_list = data.strip().split(/[^a-zA-Z0-9\-\']+/); 
     51                   .replace(/(?:^|\s+)[^a-zA-Z0-9]+|[^a-zA-Z0-9]+(?:\s+|$)/g, ' ') 
     52                   // strip whitespaces 
     53                   .replace(/^\s*(.*?)\s*$/, '$1'); 
     54        var data_list = data.split(/[^a-zA-Z0-9\-\'\u2019\"\`]+/); 
    5355        for (var i=0; word=data_list[i]; i++) { 
    5456            stop += stop_dict[word.toLowerCase()] ? 1:0;