坏小仔

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

var pattern = /test/;
var pattern = new RegExp("test");

i (insensitive), g (global), and m (multi-line)
/test/ig
new RegExp("test","ig"))
? i: makes the regex case insenstive. So /test/i matches not only “test”, but also
“Test”, “TEST”, “tEsT”, and so on.
? g: matches all instances of the pattern, as opposed to the default of “local” which
matches only the first occurence. More on this later.
? m: allows matches across multiple lines as might be obtained from the value of a
textarea element.

 

posted on 2012-08-21 11:09  坏小仔  阅读(115)  评论(0编辑  收藏  举报