更改字符串 notepad++ 中间的东西

Change thing in the middle of the string 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

等...

我想把它们都改成下面这样。

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+)
  • 替换为:@.html
  • UNCHECK 匹配大小写
  • 检查 环绕
  • 检查 正则表达式
  • 取消选中 . matches newline
  • 全部替换

解释:

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
          # content of group 1
.html       # literally

截图(之前):

截图(后):