Forgot password
 Register account
View 135|Reply 1

Emoji替换為黑白的

[Copy link]

3211

Threads

7832

Posts

52

Reputation

Show all posts

hbghlyj posted 2024-2-10 19:51 |Read mode
将字符串中的Emoji替换為黑白的。例如:
1+1=3? ❌
2+2=3? ❌
Javascript:'1+1=3? ❌\n2+2=3? ❌'.replace(/\p{Emoji}/gu,'$&\uFE0E')
输出
1+1=3? ❌︎
2+2=3? ❌︎

developer.mozilla.org/en-US/docs/Web/CSS/font-variant-emoji

3211

Threads

7832

Posts

52

Reputation

Show all posts

original poster hbghlyj posted 2024-2-10 20:15
\p{Emoji}把數字0-9也匹配了,應該用\p{Extended_Pictographic}
stackoverflow.com/questions/64389323/why-do-u … scapes-match-numbers

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-20 05:44 GMT+8

Powered by Discuz!

Processed in 0.010470 seconds, 22 queries