javascript正则表达式有3种修饰符/i、/m和/g。/i是我们最常用,也是最好理解的,代表正则表达式匹配的时候不区分大小写。
var regex = /abc/i; alert(regex.test("aBc"));//true
var multiline = /abc/m; var singleline = /abc/; //目标字符串不含换行符\n var target = "abcabcabc";
//正则表达式不含^或$ var multiline = /abc/m; var singleline = /abc/; var target = "abcab\ncabc";
var mutiline = /^abc/m; var singleline = /^abc/; var target = "ef\r\nabcd"; alert(mutiline.test(target));//true alert(singleline.test(target));//false
javascript正则表达式修饰符之multiline(/m)的使用
原文地址:http://blog.csdn.net/aitangyong/article/details/43989977