// function removeSpecialCharacters: removes punctuation marks and other special characters
// but allows numbers and alphabets along with language specific characters German: äöüÄÖÜß and French: ùûüÿàâæéèêëïîôœÙÛÜŸÀÂÆÉÈÊËÏÎÔŒ
functionremoveSpecialCharacters(str){
returnstr.replace(/(?!\w|\ä|\ö|\ü|\Ä|\Ö|\Ü|\ß|\ù|\û|\ü|\ÿ|\à|\â|\æ|\é|\è|\ê|\ë|\ï|\î|\ô|\œ|\Ù|\Û|\Ÿ|\À|\Â|\Æ|\É|\È|\Ê|\Ë|\Ï|\Î|\Ô|\Œ)./g,'')// regex to remove special characters
.replace(/^(\s*)([\W\w]*)(\b\s*$)/g,'$2');// regex to trim the string to remove any whitespace at the beginning or the end
}
...
...
@@ -134,7 +141,7 @@ function calculateReadingTime() {