Regex: how do you match Korean (hangul) letters in javascript (ES6)? [duplicate]

血红的双手。 提交于 2021-02-17 02:06:24

问题


How do you find Korean letters using regex in JavaScript?


回答1:


You can use the following regex

const re = /[\u3131-\uD79D]/ugi

This is the code table that I referenced: http://memory.loc.gov/diglib/codetables/9.3.html

Try it yourself:

const re = /[\u3131-\uD79D]/ugi
console.log("abcde".match(re)) // null
console.log("안녕".match(re)) // ["안", "녕"]


来源:https://stackoverflow.com/questions/38156300/regex-how-do-you-match-korean-hangul-letters-in-javascript-es6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!