Q:

Can somebody explain following java script

var td = /^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/
var b = td.exec("test");
alert(b);

The results is .... test,,,test or you can say an array of length 4 with the 1st and last elements of the array being string itself but middle two elements are empty. 

A:

Your regex /^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/ means:
/           : regex delimiter
  ^         : start of string
    (?:      : start NON capture group
      (     : start capture group 1
        \w+ : 1 or more letter, digit or _
      )     : end group 1
      \.    : a dot
    )?       : end non capture group, optional
    (?:      : start NON capture group
      (     : start capture group 2
        \w+ : 1 or more letter, digit or _
      )     : end group 2
      :     : column
    )?       : end non capture group, optional
    (       : start capture group 3
      \w+   : 1 or more letter, digit or _
    )       : end group 3
  $         : end of string
/           : regex delimiter

You can see you have 3 capture groups. 
With the word test, the first group is empty because you don't have a dot after test; the second group is also empty because you don't have : after test; only the third group contains test. 
The result of var b = td.exec("test"); is an array where, in first element b[0] you'll find the whole match (ie.  test), then b[1] and b[2] contains respectivly the first and the second group that are empty; b[3] contains the third group that is test. 
That's why your resulting array is 
['test', '', '', 'test']
 |       |   |   third group
 |       |   second group
 |       first group
 whole match

