Reputation: 437
'01:32:54:67:89:AB'.match(/(([A-F0-9]{2}):){5}\2/); //null
Why does not link back to the group?
If you write well, it all works:
(([A-F0-9]{2}):){5}([A-F0-9]{2})
Upvotes: 0
Views: 45
Reputation: 13650
\2
is not back reference to the pattern. It is back reference to the 2nd captured group.
In your pattern 89
is captured in the 2nd group.. so it will search for 89
.. hence you are not getting the match.
For example:
(["'])\w+\1
will match "Hello"
since both ends on the same first match "
but it will not match "Hello'
Upvotes: 2