Highlighting regex capture groups in notepad++?

谁说胖子不能爱 提交于 2019-12-20 04:22:16

问题


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?

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.

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?


回答1:


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.

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



来源:https://stackoverflow.com/questions/28220694/highlighting-regex-capture-groups-in-notepad

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!