正则表达式剥离图像网址? [英] regex to strip out image urls?
本文介绍了正则表达式剥离图像网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从文档中分离出一堆图片网址,其中图片与以下名称相关联:
I need to separate out a bunch of image urls from a document in which the images are associated with names like this:
bellpepper = "http://images.com/bellpepper.jpg"
cabbage = "http://images.com/cabbage.jpg"
lettuce = "http://images.com/lettuce.jpg"
pumpkin = "http://images.com/pumpkin.jpg"
我假设我可以通过以下方式检测链接的开始:
I assume I can detect the start of a link with:
/http:[^ ,]+/i
但是如何才能将所有链接与文档分开?
But how can I get all of the links separated from the document?
编辑:澄清问题:我只想删除文件中的URL减去变量名称,等号和双引号,所以我有一个新文件只是一个URL列表,每个line。
To clarify the question: I just want to strip out the URLs from the file minus the variable name, equals sign and double quotes so I have a new file that is just a list of URLs, one per line.
推荐答案
试试这个......
Try this...
(http://)([a-zA-Z0-9\/\\.])*
这篇关于正则表达式剥离图像网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文