排除bcd,查一下exec函数再看看

解决方案 »

  1.   

    E:Web2.0
    [0]匹配(\w+)(\d)\.(\d)
    [1]匹配(\w+)
    ...
      

  2.   

    exec是正则的方法,执行效果是对字符串做正则匹配,以数组形式返回匹配的字符串段
      

  3.   

    someText = 'Web2.0'; 
    pattern = /(\w+)(\d)\.(\d)/i; 
    outCome = pattern.exec(someText); 
    alert(outCome[0])//Web2.0
    alert(outCome[1])//Web
    alert(outCome[2])//2
    alert(outCome[3])//0
    alert(outCome[4])//undefined第一个是全部匹配 然后就是第一个括号的比配 第二个 第三个………………
    建议买本《javascript高级程序设计》 里面有
      

  4.   

    someText = 'Web2.0'; 
    pattern = /(\w+)(\d)\.(\d)/i; 
    outCome = pattern.exec(someText); 
    for(var i in outCome)
    document.writeln(i)//input index lastIndex 0 1 2 3 
    alert(outCome['input'])//Web2.0
    alert(outCome['index'])//0
    alert(outCome['lastIndex'])//6
    alert(outCome[0])//Web2.0
    alert(outCome[1])//Web
    alert(outCome[2])//2
    alert(outCome[3])//0
    alert(outCome[4])//undefined
      

  5.   

    因为那个函数  是造javascript的人起的  他就起的exec 没有exed这个函数名
    如果你能造另一个脚本语言  你也可以起个exed的名字 或者其他的名字
      

  6.   

    如果匹配 返回一个数组, 否则 null
    数组内容
    [$+, $1, $2, $3, ..., $n]$+ 是被匹配到的整串
    $1 - $n 分别是捕获组 1-n
    题中就是 "Web2.0" 把