从javascript中的字符串中删除Niqqud [英] remove Niqqud from string in javascript
问题描述
我有这里描述的确切问题:
I have the exact problem described here:
一直在努力删除 niqqud(用于表示元音或区分希伯来字母表字母的替代发音的变音符号).例如,我有这个变量:sample1 <- "הֻסְמַק"
Have been struggling to remove niqqud ( diacritical signs used to represent vowels or distinguish between alternative pronunciations of letters of the Hebrew alphabet). I have for instance this variable: sample1 <- "הֻסְמַק"
而且我找不到有效的方法来去除字母下方的标志.
And i cannot find effective way to remove the signs below the letters.
但就我而言,我必须在 javascript 中执行此操作.
But in my case i have to do this in javascript.
基于 此处 描述的 UTF-8 值表,我尝试了这个 regex 没有成功.
Based of UTF-8 values table described here, I have tried this regex without success.
推荐答案
您的正则表达式只是一个小问题.请尝试以下操作:
Just a slight problem with your regex. Try the following:
const input = "הֻסְמַק";
console.log(input)
console.log(input.replace(/[\u0591-\u05C7]/g, ''));
/*
$ node index.js
הֻסְמַק
הסמק
*/
这篇关于从javascript中的字符串中删除Niqqud的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!