正则表达式希腊字符数 [英] Regexp Greek chars by number

查看:157
本文介绍了正则表达式希腊字符数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我处理包含希腊和英语(拉丁)文本的字符串.我想使用正则表达式来捕获所有希腊文字,这些希腊文字中包含4个或更多字符.

I deal with strings that contain Greek and English (Latin) text. I'd like to use a regex to catch all the Greek words that contain 4 or more characters on them.

使用正则表达式手册,我发现可以使用\ p {Greek}捕获所有希腊语单词,并使用\ w {4,}来捕获4个以上的字符单词.但是,从我进行的各种测试来看,这两个并不能协同工作.

Using regexp manual I figure out that I can use \p{Greek} to grab all Greek words and \w{4,} in order to grab 4+ character words. However, these two don't work together, from various tests I made.

有什么办法可以使用1个regexp表达式来做我想做的事情吗?字符串是UTF-8,来自tweet.

Is there any way to do what I want using 1 regexp expression? Strings are UTF-8 and come out of tweets.

致谢

推荐答案

您是否正在使用UTF-8模式修饰符?

Are you using the UTF-8 pattern modifier?

/\p{Greek}{4,}/u

这篇关于正则表达式希腊字符数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆