You don't say what regex variant you are using so this may not work, but you could try prefixing the pattern with something like:
(?=^.{1,100}$)
This assumes that you want to limit the whole pattern to 100 (or whatever number you put in) characters, that you are counting characters (not treating "==" (say) as a single item) and that you are counting all characters.
This will check (but not move the match starting point or capture any text) that there is at least 1 character and at most 100 characters between the start and the end. If not then the pattern will fail. Otherwise, the rest of the pattern is tried as usual.
Susan