使用ngx.re.gmach匹配emoji,出现错误如下pcre_compile() failed: nothing to repeat in "(\w+|®|⏭|⏪|❓|➕|✖|☀|⏏|☝|⤵|♉|⬜|✈|⚒|⛹|☎|✅|◀|⚓|....

69 views
Skip to first unread message

xiang peng

unread,
Aug 15, 2019, 3:16:49 AM8/15/19
to openresty
伪代码如下
local it,err = ngx.re.gmatch(word, [[\w+|✊🏿|2️⃣|⛹🏼|✍🏼|☝🏼|⛹🏿|✋🏾|✊🏻|✊🏽|3️⃣|☝🏾|✌🏻|⛹🏾|✋🏼|✍🏿|9️⃣|✊🏾|✌🏾|⛹🏽|✍🏻|*️⃣|✋🏻|⛹🏻|✌🏼|#️⃣|☝🏿|✍🏾|✌🏽|0️⃣|🏊🏼|🇰🇲|🤰🏾|🇬🇷|🇾🇪|🇫🇰|🧝🏼|💇🏾|🇬🇺|🇧🇮|👰🏻|🇳🇴|🛌|...]])
其中的...表示更多的emoji表情,我遇到的问题是这里只能添加到1448个表情,再多出现pcre_compile() failed: nothing to repeat in "(\w+|®|⏭|⏪|❓|➕|✖|☀|⏏|☝|⤵|♉|⬜|✈|⚒|⛹|☎|✅|◀|⚓|....这样的错误,这有啥解决的办法没,感谢

wd

unread,
Aug 15, 2019, 10:07:32 PM8/15/19
to open...@googlegroups.com
感觉你这思路似乎不对,emoji 在 unicode 里面有范围的,可以直接去用那个范围来匹配。

--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty...@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
归档: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
教程: http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html
---
您收到此邮件是因为您订阅了Google网上论坛上的“openresty”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到openresty+...@googlegroups.com
要在网络上查看此讨论,请访问https://groups.google.com/d/msgid/openresty/a20a3b20-843f-4640-95ac-4a742ed2d6cb%40googlegroups.com
Reply all
Reply to author
Forward
0 new messages