Is there a way I can do a string pattern that will match "ab|cd"
so it matches for either "ab"
or "cd"
in the input string. I know you use something like "[ab]"
as a pattern and it will match for either "a"
or "b"
, but that only works for one letter stuff.
Note that my actual problem is a lot more complicated, but essentially I just need to know if there is an OR thing in Lua's string manipulation. I would actually want to put other patterns on each sides of the OR thing, and etc. But if it works with something like "hello|world"
and matches "hello, world!"
with both "hello"
and "world"
then it's great!
(lpeg.P("foo") + "bar"):match(input)
– Ondine