diff --git a/dist/string.js b/dist/string.js index 85de7ae..1a1abcb 100644 --- a/dist/string.js +++ b/dist/string.js @@ -502,8 +502,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson }, stripPunctuation: function() { - //return new this.constructor(this.s.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g,"")); - return new this.constructor(this.s.replace(/[^\w\s]|_/g, "").replace(/\s+/g, " ")); + return new this.constructor(this.s.replace(/[^\w\s]|_/g, function(x) { return latin_map[x] ? x : ""; }).replace(/\s+/g, " ")); }, stripTags: function() { //from sugar.js @@ -1181,4 +1180,4 @@ string.js - Copyright (C) 2012-2014, JP Richardson },{"./_count":1,"./_splitLeft":2,"./_splitRight":3}]},{},[4]) (4) -}); \ No newline at end of file +}); diff --git a/lib/string.js b/lib/string.js index 985944e..2b345fd 100644 --- a/lib/string.js +++ b/lib/string.js @@ -425,8 +425,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson }, stripPunctuation: function() { - //return new this.constructor(this.s.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g,"")); - return new this.constructor(this.s.replace(/[^\w\s]|_/g, "").replace(/\s+/g, " ")); + return new this.constructor(this.s.replace(/[^\w\s]|_/g, function(x) { return latin_map[x] ? x : ""; }).replace(/\s+/g, " ")); }, stripTags: function() { //from sugar.js diff --git a/test/string.test.js b/test/string.test.js index 254afb1..85803fc 100644 --- a/test/string.test.js +++ b/test/string.test.js @@ -632,7 +632,8 @@ describe('- stripPunctuation()', function() { it('should strip all of the punctuation', function() { - T (S('My, st[ring] *full* of %punct)').stripPunctuation().s === 'My string full of punct') + T (S('My, st[ring] *full* of %punct)').stripPunctuation().s === 'My string full of punct'); + T (S('Preserve German umlauts äöüÄÖÜß').stripPunctuation().s === 'Preserve German umlauts äöüÄÖÜß'); }) })