# 使用Dreamweaver正则表达式替换链接href中的内容

- Link: https://yjyj.net/learn/2044.html
- Published: 2013-03-13T18:04:34+08:00
- Author: 小 虾

在Dreamweaver中使用正则表达式替换href中的内容，就像下面这些href中的内容复杂多样的
情况下，href=”/html/u.html”，href=”/tuho/huko.html”，想将它们全部替换成href=”#” ，
具体做法如下:

查找:

    ```decode:true
    \href="[^"]*"
    ```

替换为：

    ```decode:true
    href="#"
    ```

(#为替换后的内容，可根据需要更改! 一定要勾选：使用正则表达式(X)，)

以上只是泛泛的替换href的内容，因为有很多标签都有href属性，如a、link等，若只是想替换
a标签的内容，可以这样操作：

查找:

    ```decode:true
    <a \href="[^"]*"
    ```

替换为：

    ```decode:true
    <a href="#"
    ```

(注意a 和 href的相对位置，不可照搬，可举一反三)

📚 【[招数学习](https://yjyj.net/category/learn)】专栏延伸阅读与热门精选（[全站文章归档](https://yjyj.net/archive)）：

 * [修改 .htaccess 实现 301 重定向](https://yjyj.net/learn/centos/2040.html)
 * [vps双机热备方案之:sersync2实现服务器文件实时同步](https://yjyj.net/learn/centos/1926.html)
 * [IIS6+fastcgi下PHP运行超时问题解决办法](https://yjyj.net/learn/2232.html)
 * [MaNGOS数据库导入教程](https://yjyj.net/learn/2432.html)
 * 热门必读[DMIT 全线缺货, 只剩搬瓦工了](https://yjyj.net/discover/7787.html)
 * 热门必读[俩月了, DMIT 终于补货了!](https://yjyj.net/share/7795.html)
