So specifically, I want the index of first integer that is not -1. The comma separated string contains positive integers from 01 to 24, and there are no trailing -1's.
examples:
02,-1,12 = possible, answer is 1
-1,-1,04 = possible, answer is 3
-1,23,-1 = not possible, no trailing -1's
Extra constraint we can assume for a less generic solution if it helps, maximum/always three integers in the string
I've tried regexes but since mysql only allows matching with regex not something like first index of regex, i can only write a lot of cases (one for every possibility for a fixed integer count of three) but that seems unclean.
Another thing i tried was using the first and last index of -1 since mysql has instr, but can't seem to come up with a solution where only these two are enough to find the answer.
The MySQL version is 5.7