Regex highlighting for groups in find and replace


#1

I’m using the regex for find and replace and selecting a group so that I can set that as the var I want to capture and reuse in the replace. Below is a great example but there are many others. Currently this works no problem, however the highlighting leaves something to be desired. I wish that the group I’m capturing was highlighted in a different color or outlined so that it would be more clear what I’m selecting.

Find: website: http://website.com
Replace: <a href="http://website.com">http://website.com</a>

The regex I would use

Find: website: (.*)
Replace: <a href="($1)">($1)</a>

Not sure if there is a plugin anyone knows of or if there would be a way to accomplish this without changing the engine. I checked in the inspector but it seems as if the highlight is a single piece and not pulling the group out in any way.


#2

I’m confused about what the context is. You’ve categorized this thread as #electron, but it sounds like you might be asking about finding and replacing text in Atom.


#3

I am asking about the find and replace function in Atom, I was under the impression that it was part of the electron shell but it seems I may have been mistaken. I’m just looking for insight into a plugin or better solution. If you have a recommendation on how to tag this please let me know and I’ll change it.


#4

#5

Regular expression matching in JavaScript is implemented in the engine, in this case V8 (taken from Chromium), which is incorporated into Electron. The find and replace functionality for Atom is implemented in the find-and-replace core package. The #support category would be appropriate.

I’ve scanned the package list and don’t see anything that seems to do what you want, but it doesn’t seem like it would be too hard to change the highlighter to pay attention to capture groups.


#6

I think you are looking for a resource to help you develop a regex.
I do not know inside atom, but regex101 is a free website that does that.

Here’s a snippet with your example

https://regex101.com/r/2C1imV/2