I'm looking for a regex that matches strings with a given length (parameterized) that start with "+" or a lowercase letter. It additionally must contain at least one uppercase letter followed by a digit and it must not end with a digit. In between there can be lower and uppercase letters as well as digits [a-zA-Z0-9]. This string may be part of a larger string.
I've got difficulties implementing the length restriction. Tried to solve it with a lookahead but it won't work. Let's say the string's length shall be 10:
(?!.{10,})[a-z\+][a-zA-Z0-9]*([A-Z][0-9])+[a-zA-Z0-9]*[a-zA-Z]
Lengtt of 10:
These example strings should be matched:
c4R9vMh0Lh
+lKj9CnR5x
These example strings should not be matched:
9kR7alcjaa
+5kl9Rk9XZ
aBikJ6clo9
Length of 4:
These example strings should be matched:
aR3v
+K7Z
These example strings should not be matched:
9R3v
+7KZ
aK79
Can you give me some hints?