ץʤɤǥƥȸ򰷤ɽ(Regular Expression)˴ؤ

ե

ġ

Javascriptɽ

match᥽åɤǡʸ󤫤ɽΥѥ˹פʸФ롣 ФʸϡString֥ȤǤϤʤ󡪡

ʲϡƥХ륹å̵ξ硣

var test = "abcd_efg 123 xyz";
var res = test.match( /^\w+/ );
if (res != null) {
  alert(res);  //ޥåʸ
  alert(res.length);  //ʸΥޥåĿ(Х륹å̵1)
  alert(res[0].length);  //ޥåʸĹ
  alert(test.substr(res[0].length));  //(ǽ˥ޥåʬλĤ)
}

ʤǤɽ


  ȥå   ʬ Хåå   ñ측 ǽ   إ   ǽRSS
Last-modified: 2012-10-18 () 00:44:42 (2412d)