首页 > 解决方案 > 更改字符串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 谢谢

标签: hyperlinknotepad++

解决方案


  • 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

截图(之前):

在此处输入图像描述

截图(之后):

在此处输入图像描述


推荐阅读