记事本++正则表达式反向引用丢失

发布于 2024-12-18 16:43:03 字数 771 浏览 1 评论 0原文

我有这个 HTML 部分:

<a href="http://always-same-path.to/my/file.pdf">Random reference</a>

这一行存在于很多文件中。

我需要将其替换为:

Random reference <lots>of tags</lots>

通常的正则表达式(Ctrl + F)效果很好。不幸的是,替换文本太长,无法在通常的正则表达式中使用,因此我使用了 TextFX 的高级搜索和替换插件。

这是我的发现:

<a href="http://always-same-path.to/my/file.pdf">(.+)</a>

这是我的替换:

\1 <lots>of tags</lots>

查找作品(即该行突出显示) 然而,更换则不然。 我得到这个:

<lots>of tags</lots>

这些选项在“查找/替换”窗口中检查:

  • Regular Expr
  • Autograb Find Text
  • Wrap

提前致谢

I have this HTML part :

<a href="http://always-same-path.to/my/file.pdf">Random reference</a>

This line exists in a lot of files.

I need to replace it with :

Random reference <lots>of tags</lots>

The usual regex (Ctrl + F) works well. Unfortunately, the replacement text is way too long and can't be used in the usual regex, so I used TextFX's advanced Search and replace plugin.

This is my find:

<a href="http://always-same-path.to/my/file.pdf">(.+)</a>

This is my replace:

\1 <lots>of tags</lots>

Finding works (i.e. the line is highlighted)
Replacing, however, doesn't.
I get this instead :

<lots>of tags</lots>

Those options are checked in the Find/replace window:

  • Regular Expr
  • Autograb Find Text
  • Wrap

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彡翼 2024-12-25 16:43:03

对我来说同样的问题,但已解决!

我刚刚在替换字段 $0 中使用,它起作用了!

我的 Notepad++ 版本:v6.1.5 UNICODE(刚刚更新! - 我建议您也这样做)

我正在处理的文件格式:.srt(电影字幕)

“查找内容”字段:< code>^\d+$ [仅包含数字的匹配行]

“替换为”字段:----- $0 ------

Same issue for me, but resolved!

I just used in the replace field $0 and it worked !

My Notepad++ version: v6.1.5 UNICODE (just updated! - I would suggest you to do the same)

File format I'm working on: .srt (movie subtitles)

"Find What" field: ^\d+$ [matching line with just a number]

"Replace with" field: ----- $0 ------

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文