I am curious why this does not work, and I need to know why and how to get around it; I'm trying to determine if some input is a question, I'm sure string.match is what I need, but:
print(string.match("how much wood?", "(how|who|what|where|why|when).*\\?"))
returns nil. I 'm sure Lua string.match uses regular expressions to find matches in a string, since I used wildcards (.) Before with success, but maybe I don't understand all the mechanics? Does Lua need special separators in string functions? I checked my regex here , so if Lua used regular regex, it seems that the above code will return "how much wood?" .
Can any of you tell me what I'm doing wrong, what I wanted to do, or give me a good link where I can get comprehensive information on how Lua manipulation functions use regular expressions?
source share