The regex stops matching simply because the next (BF..) part is not a digit. If you wanted to limit the match to 16 sets of digits, you could replace the last + with {16} . In regex {n,m} indicates that the preceeding character/class must repeat a minimum of n times and a maximum of m times. The ,m is optional, and if excluded, indicates that exactly n repetitions must exist.