Extracting regex submatch boundaries without backtracking I'm attempting to develop from scratch a simple regex engine.  I would like for my engine to have the ability to report, &quot;The regex matched on a substring of this line starting at index  and ending at index .&quot;
It makes sense to me how to accomplish this using recursive backtracking.
However, I'd like my implementation of the search to use Thompson's multi-state approach.  Is this feasible?
It occurred to me after I made this post that I could store the states in a linked list format:
typedef struct stateRecord {
    struct stateRecord *next;
    size_t state;
    size_t startIdx;
    size_t endIdx;
} stateRecord;