I am attempting to remove the vowel points from Hebrew language. The following code is successful at removing the vowel points:
function removeVowels(text) {
return text.replace(/[u0591-u05C7]/g, "");
}
const originalText =
"אָדָ֛ם בְּצַלְמֵ֖נוּ כִּדְמוּתֵ֑נוּ וְיִרְדּ";
const vowelsRemoved = removeVowels(originalText);
// print out the results
console.log(vowelsRemoved);
Returning:
אדם בצלמנו כדמותנו וירד
However, I would like to do things differently:
- Instead of entering the Hebrew into the .js file, I would like this function to change the text of a whole document called ‘hebrew.txt’.
- Instead of printing the result in terminal, I would like it to overwrite the content of ‘hebrew.txt’, with a console message telling me when it has finished.
Do I need to use fs.writeFile
somehow?
Much appreciated.
Edit: If it makes any difference, I am using Linux.