Oh, in that case, /^(\w+)\1|(\w+)(\w+)\3\2$/
doesn't match saaa which is part of your own test
case. You know, just pick $x = "sa" and $y = "aa", so it
matches this new "$x$y" requirement.
Don't you read your own comments? "$x$x" or "$x$y$y$x".
Not "$x$y", which could be matched by /^\w{2,}$/.