^start of line
\d*a digit, repeated any number of times
Positive Lookahead(?=\d{5}(\d*)$) \d{5}a digit, repeated exactly 5 times
\d*a digit, repeated any number of times
$end of line
0?optionally matches the literal 0 (4810 / 608 / 3016)
1?optionally matches the literal 1 (4910 / 618 / 3116)
2?optionally matches the literal 2 (5010 / 628 / 3216)
3?optionally matches the literal 3 (5110 / 638 / 3316)
4?optionally matches the literal 4 (5210 / 648 / 3416)
5?optionally matches the literal 5 (5310 / 658 / 3516)
6?optionally matches the literal 6 (5410 / 668 / 3616)
7?optionally matches the literal 7 (5510 / 678 / 3716)
8?optionally matches the literal 8 (5610 / 708 / 3816)
9?optionally matches the literal 9 (5710 / 718 / 3916)
\1the text saved by group 1
$end of line
g modifier: global. Finds all matches instead of stopping after the first
m modifier: multiline. Causes ^ and $ to match the start and end of each line, not only the start and end of the string