gpt4 book ai didi

javascript - 从javascript中的字符串中删除Niqqud

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:42:25 24 4
gpt4 key购买 nike

我有这里描述的确切问题:

removing Hebrew "niqqud" using r

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 中执行此操作。

基于描述的 UTF-8 值表 here ,我试过这个regex没有成功。

最佳答案

您的正则表达式只是一个小问题。尝试以下操作:

const input = "הֻסְמַק";
console.log(input)
console.log(input.replace(/[\u0591-\u05C7]/g, ''));

/*
$ node index.js
הֻסְמַק
הסמק
*/

关于javascript - 从javascript中的字符串中删除Niqqud,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37716995/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com