Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
262 views
in Technique[技术] by (71.8m points)

正则如何匹配繁体字?

需求是:在文章中,匹配到繁体字并将其去掉。
最初想使用匹配unicode的方法,后发现无效,没了思路。
请问如何解决?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

没啥好的方案。。因为 Unicode 的排序是根据笔画来的,而正则匹配 Unicode 也是,解决方案就是创建字典,然后字典检查,比如下面在 github 上的两个开源项目,都是这种采用字典的方式。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...