53

I'm trying to select all of the results found by a regex find so I can modify them all (not replace them with text!), for example, making them all uppercase with Cmd + K -> Cmd + U. I'm aware that I could do them one by one via repeating Cmd + G, Cmd + K, Cmd + U, but for a large file this simply isn't practical or realistic. I'm also aware of using bash and may other scripting alternatives, I'd like to find a way to do it inside Atom, I'm happy to install an external library if needed.

Example of selection

Things I've tried:

  1. Cmd + D, this just selects the next instance of that exact letter, not the next result matching the regex.
  2. Cmd + Shift + G and alternatives (alt/right shift/ctrl), Cmd + G selects the next result matching the Regex, which is in the right direction.
  3. Changing all of the selected text to a unique string, highlighting them all, pressing Cmd + Z and hoping it will stay selected, it doesn't.
  4. Lots of Googling and reading though Atom discussions.
  5. Reading Atom's documentation on the subject
MattDMo
  • 100,794
  • 21
  • 241
  • 231
Aaron Critchley
  • 2,335
  • 2
  • 19
  • 32

2 Answers2

121

Pressing Alt + Enter will select all instances matching your Find results. This works for RegEx search also.

Source: https://github.com/atom/find-and-replace/pull/290

Johno
  • 1,959
  • 1
  • 15
  • 15
  • 4
    @MikaA. it's still Alt-Enter. – henrebotha Apr 11 '16 at 14:39
  • 6
    @MikaA. [alt] translates to [option] on Macs. Most keyboards include both words on the same key. – intcreator Jun 01 '16 at 18:23
  • This is really neat for some things that are hard or impossible with Atom's regex replace (e.g. converting to lowercase), but it only applies to one file at a time. I could imagine an improved regex replace that does most of this on multiple files at once. – combinatorist Oct 04 '17 at 20:44
  • On Atom 1.57 (nov 2021) you click "find all" then copy :) – NicoKowe Nov 10 '21 at 18:55
3

On Atom 1.57 (nov 2021) clicking on "find all" selects all matching items, esc to exit the search box, then copy :)

enter image description here

Alternatively you can select all whit the menu -> find > select all.

On mac also selects all by pressing ^ + cmd + G.

NicoKowe
  • 2,989
  • 2
  • 19
  • 26
  • thank you @NicoKowe, you saved my life. I did this - clicking on "find all" selects all matching items, esc to exit the search box, then copy :) – Praveen Kondapalli Nov 01 '22 at 06:58