Why do you want this feature? What is your use-case?
state->charsize is const during matching, and all "switch" are in loops(backtrack, advance), since these functions have heavily duplicate code.
it should be bring out of loops not only for performance but also for maintenance.
What should the syntax or call look like?
Do any other regex implementations have something like this?
Please provide any additional information below.