如何复制“标题” 作为“替代” “img”的。手动使用正则表达式?
如何添加链接标题作为 img 的 alt。在 Dreamweaver 中使用正则表达式。我必须在一个大文档中做。以及在多个文件中
之前
<a title="Whatever is written here" href="#" target="_blank">
<img width="14" height="14" src="#" /></a>
之后
<a title="Whatever is written here" href="#" target="_blank">
<img width="14" height="14" src="#" alt="Whatever is written here" /></a>
How to add title of link as a alt of img. using regex and in dreamweaver. I have to do in a large document. and in multiple files
Before
<a title="Whatever is written here" href="#" target="_blank">
<img width="14" height="14" src="#" /></a>
after
<a title="Whatever is written here" href="#" target="_blank">
<img width="14" height="14" src="#" alt="Whatever is written here" /></a>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试搜索
并替换为
这假设
标记和
标记之间没有其他标记,并且没有(转义) )
title
属性内的引号。编辑:将
\1
反向引用语法更改为$1
。Try searching for
and replacing with
This assumes that there is no other tag between the
<a>
tag and the<img>
tag, and that there are no (escaped) quotes inside thetitle
attribute.EDIT: Changed
\1
backreference syntax to$1
.执行此操作的最佳方法是使用某种脚本语言(ruby、python 等)编写一个脚本:
已经有一些库可以解析 html/xml(例如ruby.hpricot)
The best way to do this is to write a script in some scriptiong language (ruby, python etc.) that:
There are already some libraties to parse html/xml (ruby.hpricot for example)