close

在regular expression中 , 我們可以藉由g modifier來決定是否進行global match ,

(也就是match所有符合的部分 , 而非只停留在第一個)

var str="Is this all there is?";

var patt1=/is/g;

如此一來 , 所有is都會被match到.

Is this all there is?


ref : http://www.w3schools.com/jsref/jsref_regexp_g.asp

arrow
arrow
    文章標籤
    javascript regular expression
    全站熱搜

    JerryCheng 發表在 痞客邦 留言(0) 人氣()