使用 GREP 修改 URL
我有很多像这样的网址,
<a href="http://abc123.linkbucks.com"><img src="http://img187.imagevenue.com/loc1115/th_99189_image_122_1115lo.jpg" /></a>
我需要用 img src 部分替换 href 部分,所以它会说
<a href="http://img187.imagevenue.com/loc1115/th_99189_image_122_1115lo.jpg"><img src="http://img187.imagevenue.com/loc1115/th_99189_image_122_1115lo.jpg" /></a>
,然后用 img.php?image= 替换 loc???/th_ 部分,这样
<a href="http://img187.imagevenue.com/img.php?image=99189_image_122_1115lo.jpg"><img src="http://img187.imagevenue.com/loc1115/th_99189_image_122_1115lo.jpg" /></a>
任何人都可以帮我用 Mac 版 TextWrangler 做到这一点吗? linkbucks 链接以及 loc 和 img 位都是随机的。我尝试过搜索,但解决方案似乎非常具体,而且我对正则表达式的理解非常缺乏......谢谢!
I have a lot of URLs like this one
<a href="http://abc123.linkbucks.com"><img src="http://img187.imagevenue.com/loc1115/th_99189_image_122_1115lo.jpg" /></a>
I need to substitute the href part whith the img src part, so it would say
<a href="http://img187.imagevenue.com/loc1115/th_99189_image_122_1115lo.jpg"><img src="http://img187.imagevenue.com/loc1115/th_99189_image_122_1115lo.jpg" /></a>
and then replace the loc???/th_ part with img.php?image= so it would be
<a href="http://img187.imagevenue.com/img.php?image=99189_image_122_1115lo.jpg"><img src="http://img187.imagevenue.com/loc1115/th_99189_image_122_1115lo.jpg" /></a>
Can anyone help me do this with TextWrangler for Mac? The linkbucks links and loc and img bits are all random. I've tried searching but the solutions seem to be very specific and my understanding of regex is so scarce... Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:
我不知道 TextWrangler,但我可以想象以下内容可能有效:
Edit:
I don't know TextWrangler but I could imagine that following might work: