Reputation: 5384
Using lua pattern-matching, I would like to match and capture "/egg/" or "/spam/" words
Expected string.find(haystack, pattern) results:
"/spam/" -> captures "spam"
"/egg/" -> captures "egg"
"/spamegg/" -> returns nil and captures nothing
"/foo/" -> returns nil and captures nothing
I know how to match either "egg" or "spam" but could not find a way to expresse the logical OR (though it seems vory simple).
Upvotes: 1
Views: 917