I'm trying to do a regex that captures the longest string before a possibly ending letter "c", in Lua.
For example,
- Given
abc, matchab - Given
acc, matchac - Given
abcd, matchabcd - Given
abd, matchabd
The solution I came up is ^(.+(?=c$)|.+(?!c$)). However, Lua does not have lookahead, so I'm thinking if there is a way to reduce this to something that Lua natively supports.