仅需要将包含“_%7bwidth%7d”的行中的“html”一词替换为“jpg”
^(.*_%7bwidth%7d.*)html
按使用https://stackoverflow.com/questions/37685633/how-to-find-and-replace-in-the-marked-lines-in-notepad?noredirect=1&lq=1 ^(.*XYZ.*)PROBLEM
,但它会突出显示(并因此替换)整行,而不仅仅是“html”。我也尝试过将 html 放在括号 () 中。我怎样才能让它只针对单词“html”而不是整行?
当前的:
`../../files/1/0400/8883/0101/products/81WG5qy3-VL._AC_SL1500_%7bwidth%7dxc3a8.html?v=1608528017`
预期结果:
`../../files/1/0400/8883/0101/products/81WG5qy3-VL._AC_SL1500xc3a8.jpg?v=1608528017`
答案1
- Ctrl+H
- 找什么:
^.+?_%7bwidth%7d.*?\Khtml\b
- 用。。。来代替:
jpg
- 打钩 相符
- 打钩 环绕
- 选择 正则表达式
- 取消勾选
. matches newline
- Replace all
解释:
^ # beginning of line
.+? # 1 or more any character but newline
_%7bwidth%7d # string to be found
.*? # 0 or more any character but newline
\K # forget all we have seen until this position
html # string to be replaced
\b # word boundary
截图(之前):
截图(之后):