:: thinking how I'd approach this in an e-book ::
pattern: 1 or more digits \d contained within square brackets, separated by one or more non-digits.
I think it's easiest to do it in multiple passes rather than try it all in one fell swoop. You're replacing
(\d+)
with something like
<a href[^>]+>\d+</a>
where presumably the captured digits $1 or \1 are used as part of the link.
So the pattern is
(\[(?:<a href[^>]+>\d+</a>[^\d<\]]+)*)(\d+)
change to
$1<a href et cetera>$2</a>
and repeat until it rinses clean.
In groups like "2-3" or "4-7" do you want each part separately anchored, or a single anchor for the whole unit? In the latter case, replace the sequence (\d+) wherever it occurs with (\d+)(-\d+)?. Note here that you have to capture the two parts separately, because only the first number will be used in the link. So you'll have
<a href et cetera including $2 somewhere>$2$3</a>
Anyway, that's what I would do in the index of an e-book (something I have a LOT of experience with :().
numbers not in [ ] may also get linked.
You wouldn't want them to, would you? Unless you have very unusual content, such that you can be reasonably certain the only numerals will be footnote references. You could also do it if the only non-footnote numerals are dates, so you can distinguish between \d{1,2} and \d{4,}. You would then need to express the search as \b\d\d?\b to make sure your Regular Expression doesn't sneakily try something like
1<a href et cetera including 94 here>94</a>5.
Edit: Oops. I guess I misread that. With appropriate use of [^\]] you can ensure that links only happen inside of square brackets.