互联网技术 · 2024年2月28日

常见的中文正则表达式 – JavaScript 正则表达式

^ 脱字符:匹配开头,若存在多行匹配多行的行头。$ 美元符:匹配尾部,若存在多行匹配多行的尾部。我们知道正则是一种匹配模式,要么匹配字符,要么匹配位置。

包含中文正则

//包含中文正则
var cnPattern = /[u4E00-u9F]/;
//输出 true
console.log(cnPattern.test(“42度”));

OpenMagic API

Need more than content? Move into the product flow.

If you are here for model access, pricing, developer docs, or the future API console, the dedicated product path now lives on api.openmagic.ai.