Question

I made a simple regex search in Netbeans 7.3 on Windows (using Ctrl+F):

\{\{.*?\}\}

The results get highlighted correctly and the question is - how to extract highlighted text search results? Let it be copying to clipboard, saving as file or whatever else.

Is there any method doing this?

Maybe someone has any suggestion of alternative quick approach to such task in Netbeans? (or other editor)

Was it helpful?

Solution

What OS are you running? If OS X or Linux, read on!

I'm not sure about automatically copying the highlighted results to the clipboard, but I do workaround this quite a bit as well.

The easiest way to accomplish this for me without leaving NetBeans is to simply open a built in terminal window through Window>Output>Terminal (in 7.2.1) - I then navigate to my project, and run the RegEx that I built in the Find feature with my tool of choice. In fact, I use the built in terminal for this type of quick stuff in NetBeans quite a bit. If running Linux, using clipboard tools like xsel (http://linux.die.net/man/1/xsel) in combination with a built in terminal emulator can allow for devising some nice workflow shortcuts within IDEs if you are more comfortable working/coding at a terminal. Note that built in terminal emulators like the one in NetBeans is likely not going to play nicely with cut/copy/paste using the mouse, for various reasons that I won't get in to here.

As far as a built in/extension based solution for something like this, it would be helpful! I am not aware of one.

Hope this workaround helps in the meantime.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top