As already answered here, the easiest way is to simply remove + :
^123\\d{9}$
or
^123\\d{6}$
Depending on what you need for sure.
You can also use a different, more complex and general approach, a negative look:
(?!.{10,})^123\\d+$
Explanation:
This: (?!.{10,}) is a negative forward look ( ?= Will be a positive forward look), this means that if the expression after waiting matches this pattern, then the general line does not match. Roughly this means: the criteria for this regular expression are satisfied only if the template in the negative appearance does not match.
In this case, a string matches only if .{10} does not match, which means 10 or more characters, so it matches only a pattern match of up to 9 characters.
A positive forecast ahead does the opposite, only a coincidence if the criteria in the forecast also coincide.
Just putting it here for the sake of curiosity, it is more complex than what you need for this.
source share