So you want number (+ an integer) followed by something until the next number (or end of line), right?
Then you need to report this to the regex engine:
Pattern pattern = Pattern.compile("number\\d+(?:(?!number).)*");
In your regular expression .* Matched as much as you could - everything to the end of the line. Also, did you do the second part (number\\d+)? part itself.
Explanation of my solution:
number
Tim pietzcker
source share