javascript - RegExp. Search MAC-adress -


'01:32:54:67:89:ab'.match(/(([a-f0-9]{2}):){5}\2/); //null 

why not link group?

if write well, works:

(([a-f0-9]{2}):){5}([a-f0-9]{2}) 

\2 not reference pattern. reference 2nd captured group.

in pattern 89 captured in 2nd group.. search 89.. hence not getting match.

for example:

(["'])\w+\1 match "hello" since both ends on same first match " not match "hello'


Comments

Popular posts from this blog

xslt - Substring before throwing error -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

oracle - Changing start date for system jobs related to automatic statistics collections in 11g -