Lua模式中的交替运算符是什么? [英] What is the alternation operator in Lua patterns?

查看:101
本文介绍了Lua模式中的交替运算符是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在正则表达式中,|用于交替. Lua模式中对应的字符是什么?

In regex, | is used for alternation. What is the corresponding character in Lua patterns?

推荐答案

首先,请注意Lua 模式不是正则表达式;它们是他们自己更简单的匹配语言(具有不同的优缺点).

First, note that Lua patterns are not regular expressions; they are their own simpler matching language (with different benefits and drawbacks).

根据我上面链接的说明以及此答案,Lua中没有替代运算符图案.要获得此功能,您需要使用功能更强大的Lua构造(例如 LPEG Lua Regex库).

Per the specification I've linked to above, and per this answer, there is no alternation operator in a Lua pattern. To get this functionality you'll need to use a more powerful Lua construct (like LPEG or a Lua Regex Library).

这篇关于Lua模式中的交替运算符是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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