js中的正则提取

提取img标签
arr=[<a href=’/Uploads/file/20220106/61d6b285308a5.jpg’ target=_blank><img src=’/Uploads/file/20220106/61d6b285308a5.jpg’ width=’30’ height=’30’ /></a>
<a href=’/Uploads/file/20220106/61d6b2853d880.jpg’ target=_blank><img src=’/Uploads/file/20220106/61d6b2853d880.jpg’ width=’30’ height=’30’ /></a>
<a href=’/Uploads/file/20220106/61d6b2862ece9.jpg’ target=_blank><img src=’/Uploads/file/20220106/61d6b2862ece9.jpg’ width=’30’ height=’30’ /></a>]

获取img src=.*

$("#pic{$key}").html(/<img src=.*>/.exec(arr[0]))

发表回复

您的电子邮箱地址不会被公开。