在记事本++中突出显示正则表达式捕获组? [英] Highlighting regex capture groups in notepad++?

查看:45
本文介绍了在记事本++中突出显示正则表达式捕获组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

截至目前,如果我在记事本++中执行正则表达式查找和替换",它会像普通文本查找"一样突出显示整个搜索参数.

As of now if I do a regex 'find and replace' in notepad++ it highlights the entire search parameter like a normal text 'find'.

是否可以让它以不同颜色突出显示捕获组,以便我可以轻松识别我在正则表达式中捕获的内容?

Would it be possible to have it highlight capture groups in a different color so I can easily identify what I'm capturing in regex?

例如,如果我想匹配:打印 'foo.'但是用 ^print '(\w+).'$ 捕获 foo 替换字符串它将以灰色突出显示整条线.

For example, if I wanted to match: print 'foo.' But capture foo for a replace string, with ^print '(\w+).'$ It would highlight the entire line in grey.

我希望它以灰色突出显示所有内容,但以红色突出显示 foo,例如,以指定已捕获的内容,而不是在我碰巧捕获错误的内容时进行替换和撤消.每个捕获组以不同的颜色突出显示,如果您在多个组中捕获某些内容,则可能会混合颜色,obv 只会有助于更简单的捕获.这在 npp 中可能吗?

I'd like it to highlight it all in grey, but highlight foo in red, for example, to designate that was captured rather than replacing and undo-ing if I happened to capture the wrong thing. Each capture group highlighted in a different color, maybe blend the colors if you captured something in multiple groups, obv would only help for simpler captures. Would that be possible in npp?

推荐答案

目前没有这样的插件,但我会尝试测试这个站点:https://regex101.com/ 显示了很多关于比赛的信息.

For the moment there is no such plugin, but I would try for testing this site: https://regex101.com/ which shows a lot of information about matches.

或安装 RegexBuddy http://www.regexbuddy.com/demotest.html.这样你就可以在那里做一个简单的测试,然后切换到 NotePad++.

Or install RegexBuddy http://www.regexbuddy.com/demotest.html. So that you can do a simple test there and then switch to NotePad++.

这篇关于在记事本++中突出显示正则表达式捕获组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆