in reply to RegExp madness

Your {} can't take a backreference; that's not supported. So the {} doesn't look like a quantifier and the curly braces will be treated as literal characters to match. So: "34{3}"=~/^(\d)\d{\1}$/ succeeds instead of your desired "3444"=~/^(\d)\d{\1}$/.