JS Regular string of all IMG image tags and full address and ALT description
<script> var s= ' <img src= "/upload/image.jpg"/> This is some text <img src= "/upload/image.jpg" alt= "picture description"/> is also some text <img src= " Http://www.jzread.com/upload/image.jpg "/> Last Documents";
var regexp=/(<imgs*src= ") (?: Http://[w.] +)? ([^"]+) ("[^>]+>")/gim
<script> var s= ' <img src= "/upload/image1.jpg"/> This is some text <img src= "/upload/image2.jpg" alt= "Picture description 2"/> is some text <img src= "Http://www.jzread.com/upload/image3.jpg"/> Last var Imgreg =/<img.*?/?>/gi;
The string is <img src= "/upload/image.jpg"/> This is some text <img src= "/upload/image.jpg" alt= "picture description"/> is also some text <img src= " Http://www.jzread.com/upload/image.jpg "/> Last file
is a mixed-text HTML code Want to use the formal expression to automatically add the picture address full domain name, and then automatically add alt description text, but some are already with the ALT description, some are already have the full picture address Can I replace it with a regular expression?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.