4 ms·
Suppose the digit sequence is: "1, 2, 3, 4, 5". Someone says: "9, 2, 3 -- wait, the digit a few places back was a 1, not a 9 -- 4, 5". The pattern /^.*1.*2.*3.*
by eurleif 2y ago
Suppose the digit sequence is: "1, 2, 3, 4, 5". Someone says: "9, 2, 3 -- wait, the digit a few places back was a 1, not a 9 -- 4, 5". The pattern /^.*1.*2.*3.*4.*5.*$/ doesn't match; they didn't "deviate and return" in the way you seem to be implying; yet they've expressed the correction in a reasonable way that a human would understand.
- withinboredom 2y agoDepends on how you write the algorithm. As you mentioned, a regex won't work, but "1, 2, 3, 4, 5" is spoken in the clip.