Using regex captures in search-replace function in IDE 2.0

i need to partially replace text in many ide editor tabs, i am trying to use the search-replace function (the sidebar magnifying glass) with regex captured groups, like this example for identify print commands just to add \r\n at the end of printed sting

search regex: print\("(.*)"\);
replace regex: print("\1\\r\\n");

imagen

i captured the content with (.*) then i tried to include it in replacement with \1 and $1 but it prints them literally after replacIing content MESSING UP MY CODE :frowning:

p.s.: i haven't found any info on this anywhere... please somebody make a help page somewhere

Hi @atesin. Unfortunately, although VS Code's Search view does support this use case, the Eclipse Theia IDE framework on which Arduino IDE is built does not.

The Theia developers are tracking the missing capability here:

If you have a GitHub account, you can subscribe to that thread to get notifications of any new developments related to this subject:

screenshot of Subscribe button


:exclamation: Please only comment on the GitHub issue thread if you have new technical information that will assist with the resolution. General discussion and support requests are always welcome here on the Arduino Forum.


what a shame ... i hope they fix it sometime, and arduino team merge the changes (or collaborate with theia to fix it) ...

thanks for your response, you are the only one that said someting about it, and maybe now this is the only info about this in whole forum

Please only comment on the GitHub issue thread ...

ok, sorry, nevermore

You are welcome. It is unfortunate that this capability is missing. Hopefully the Theia developers will be able to pull in the implementation from VS Code (the Theia codebase is somewhat based on the VS Code codebase).

I had the idea that users might be able to add this capability to Arduino IDE by installing a VS Code extension, but unfortunately I didn't find any extensions that provide the desired capability (I guess there isn't much point in creating one when VS Code already has it by default).

For now, I think the best solution will be to use an external text editor when you need to do this. Although that is a bit inconvenient, it is the sort of thing you only do very rarely so I don't think it will be too bad. As I mentioned, VS Code's "Search" view does provide this capability. VS Code is a nice text editor so it will probably be handy to have it installed anyway. In case you aren't a big fan of "M$", you can try the open source VSCodium instead of VS Code. I haven't verified whether VSCodium has the capture group replacement feature, but there is a good chance it does since it generally has basic feature parity with VS Code.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.