in reply to Regular Expressions

It's perfectly valid result.
m/^(?:(\d+)|::)*\1$/x #which means the same as: m/^ (\d+)* #capture digits from the beginning of string \1 #than match the same digit as $1 in the end #and the backtracking (in reverse order) ends happily #where $1 is the digit before the last one $/;
So for example if you have string like '12312377' then $1 will be 7.