String Patterns - Finding the Complement of a Character Sequence?
Asked by
5 years ago Edited 5 years ago
I understand that you can find the complement of a character set. For example, the pattern [^abc]+
will find all characters that are neither "a" nor "b" nor "c".
I'm wondering if or how it's possible to find the complement of a sequence, such that unlike above, I could match all characters that are not the literal sequence "abc" instead of matching everything that's not the character "a" or "b" or "c".
If this is still confusing, this is essentially what I'm trying to do and what kind of result I expect:
1 | local text = "Hello, world! Wonderful day, isn't it?" |
3 | for a in string.gmatch(text, "Complement of 'day'" ) do |
I hope this makes my question clear. Please let me know if you need more clarification.