Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions dist/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
},

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
Expand Down Expand Up @@ -1181,4 +1180,4 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>

},{"./_count":1,"./_splitLeft":2,"./_splitRight":3}]},{},[4])
(4)
});
});
3 changes: 1 addition & 2 deletions lib/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
},

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
Expand Down
3 changes: 2 additions & 1 deletion test/string.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 äöüÄÖÜß');
})
})

Expand Down