^([CDEFGAB]#?)((?:-[1-2])|[0-8])$
This will fix several problems. First, since we add the $ at the end of the regex, it will stop at the end of the string (this prevents A10, as we match precisely one digit). Then, the segment
((?:-[1-2])|[0-8])
will either take a negative value between 1 and 2 (and not capture it twice, from (?:...)
), or it will take the original range of positive 0-8.