hyperlink - 更改字符串notepad++中间的东西
问题描述
我的文件包含如下内容:
http://example.com/main.do?y=yeay
http://example.com/main.do?y=hahahehe
http://example.com/main.do?d=wow
http://example.com/blah/blah/product.do?p=49302
ETC...
我想像下面一样改变它们。
http://example.com/main.do@y=yeay.html
http://example.com/main.do@y=hahahehe.html
http://example.com/main.do@d=wow.html
http://example.com/blah/blah/product.do@p=49302.html
这些是 html/do/asp 文件中的链接。我怎样才能改变它们?谢谢。我也可以使用其他程序,而不是 noteoad++,我同时拥有 macOS 和 WINdows 谢谢
解决方案
- Ctrl+H
- 找什么:
https?\S+?\.do\K\?(\S+)
- 用。。。来代替:
@$1.html
- 取消选中 火柴盒
- 检查 环绕
- CHECK 正则表达式
- 取消选中
. matches newline
- Replace all
解释:
https? # http OR https
\S+? # 1 or more non spaces, not greedy
\. # a dot
do # literally "do"
\K # forget all we have seen until this position
\? # question mark
(\S+) # group 1, 1 or more non spaces
替代品:
@ # literally
$1 # content of group 1
.html # literally
截图(之前):
截图(之后):
推荐阅读
- sql - 如何在不删除表数据的情况下插入 #TEMPTABLE
- c++ - 使用 PortAudio 和 libaudiodecoder 的 3D 音频
- c - 如何通过多字节数组移动一个字节
- c++ - wxColour 用 int 数组设置?
- git - Git对已标记为已合并的文件进行三向合并
- javascript - PHP:将javascript对象字符串转换为php数组
- mysql - Heroku 上的 Rails 布尔值不会从 0 切换到 1
- linux - 制作一个 bash 脚本来刷新值,而无需像 TOP 命令那样向下滚动终端
- php - Docker 从 git 下载代码并运行 php 内部服务器
- dart - 如何在 Hot Reload 上使用 Provider 维护 Flutter Global BloC 状态?