<textarea id=test style= "width:100%;height:300 " >
aaaaaaaaaaaaa
gggg[img]http://wwww.1111111[/img]3333333
bbbbbbbbbbbbb
hhhhhhhhhh[img]http://wwww.2222222[/img]444444
ccccccccccccc
</textarea>
我想得到所有[img]。。。[/img]的串...
------解决方案--------------------
<textarea id=textarea1>
aaaaaaaaaaaaa
gggg[img]http://wwww.1111111[/img]3333333
bbbbbbbbbbbbb
hhhhhhhhhh[img]http://wwww.2222222[/img]444444
ccccccccccccc
</textarea>
<script>
alert(aaa(textarea1.value))
function aaa(x)
{
var rtn= " ";
var arr = x.match(/\[img\][\s\S]+?\[\/img\]/ig);
for(i=0;i <arr.length;i++)
{
rtn += arr[i] + "\n ";
}
return(rtn);
}
</script>