正则表达式总结
在捕获组中使用标志
?
//忽略大小写/\.(?i:gif|jpe?g|png)$/
?
?
非贪婪和贪婪模式:
try{str="<p>abcdefg</p><p>abcdefghijkl</p>";re1=str.match(/<p>[\W\w]+?<\/p>/ig);alert("非贪婪模式:\r\n\r\n1:"+re1[0]+"\r\n2:"+re1[1]);re1=str.match(/<p>[\W\w]+<\/p>/ig);alert("贪婪模式:\r\n\r\n"+re1);re1=str.match(/<p>(.+?)<\/p>/i);alert("非贪婪模式,且不要标记:\r\n\r\n1:"+re1[1]);re1=str.match(/<p>(.+)<\/p>/i);alert("贪婪模式,且不要标记:\r\n\r\n"+re1[1]);}catch(e){ alert(e.description)}??
?