It's not at all clear what you're trying to do, but your input clearly doesn't match the second pattern.
Your first pattern matches any three digits, followed by a "-", followed by any other three digits.
Your second patter matches any three digits, followed by a "-", followed by
the same three digits again.
There are two possible places a match could occur:
123-456
and
456-789
. Neither of those repeat the same three digits, so neither is a match for your second expression.
You need to read up about how regular expressions work:
Regular expressions - JavaScript | MDN[
^]
And if you're going to be working with regular expressions, get yourself a copy of Expresso:
Download Expresso[
^]