//例子
var str="我的大家啊宽带连接"
document.write(str.match(/我(.{1,100})啊/g)) //输出 我的大家啊
//注意这里的正则表达式,意思是匹配我到啊之间的内容最少1次,最大100次 /我(.{1,100})啊/g
var targetText=$('#myDiv').html();//需要匹配的字符串
var matches = targetText.match(/<script(.+)<\/script>/g);//匹配<script>标签
console.log(matches);//输出所有<script>的内容