You are essentially asking Perl to match one or more digits, followed by another single digit that is equal to what it just matched. That means for the overall match to work, it needs to find two consecutive identical digits. The only place you have two equal digits are near the end of your string; '111'. The '$' anchors \1 to the right hand side of the string, so basically the last two 1's are being matched.
Dave
In reply to Re: Regular Expressions
by davido
in thread Regular Expressions
by y8
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |