首页 > 解决方案 > 如何使用正则表达式搜索 →

问题描述

我在字符串中有一个 →。(nodejs) \t 不工作。→ 的名称是什么,我该如何对其进行正则表达式?谢谢!

标签: node.jsregex

解决方案


它被称为“向右箭头”,U+2192。但由于这是一个普通的 unicode 字符,您可以将其作为文字字符放入模式中,无需特别需要:

const pattern = /→\w+/g;
console.log('→foo→bar'.match(pattern));


推荐阅读