that was quiiiick! … the capturing groups might do the trick. i am currently in regex101 playing around.
have tried it with the following but was on the wrong path: [^test[A-Z][a-zA-Z0-9]*$|^[a-z][a-zA-Z0-9]*Test$]
in the second group the first letter needs to be lowercase … if you edit your answer i will mark it(as the answer), or i would insert the solution myself
//another edit: how did you create the shortlink to your regex101-example, i wanted to do the same but failed to create it