How to search selected text only?


Hi, before the search bar it seems to me we used to be able to search only on selected text via the search dialog.

I can't seem to find this feature anymore and if it doesn't exist I'd like to see it added back in.

I found such a feature useful for my workflow.

Can someone confirm if this feature is available in 9.x or not.

Thank you.




"Selection" is one of the options in the "Custom:" pop-up, when you select its (Custom's) radio button in the "Scope" section of the "Find in Path" dialog.

Randall Schulz


Good eye, not exactly a logical step to have "Selection" in "Search in Path" but hey.

It doesn't seem to be working completely however, I select the text, bring up the dialog box, fill in my values carefuly, select custom->Selection then I get "No occurences of  'My Text' found in Selection" even though it should match.

Attaching screen shot.

Any tips?

Thanks for the feedback.


Turns out that's not the current text selection, it's something related to custom scopes.

Sorry for the misdirection.

Randall Schulz


Here is a workaround:

ctrl+r - Replace Text dialog
Scope: Selected text

Hi Find button, ant then each time hit 'Skip' button to not do replacing but searching
F3 and ctrl+F3 will continue searching/replacing after you close this dialog


So it's 2019 and this is still the case. I guess we just won't ever get "Find in Selection"?

  • as of 2020, I'm able to perform find in selection on PhpStorm
  • There's an 'In Selection' button on the find toolbar (that appears on top when we hit Cmd + F on MacOS / Ctrl + F on Windows on other platforms)

I'm using

  • PhpStorm 2020.1.2
  • Build #PS-201.7846.90, built on June 3, 2020

Here's the link to my answer on SO


Unlike regular search, search in selection currently doesn't unfold the collapsed pieces of text to show matching text; rather it just should a line indicator before the collapsed piece indicating that a match was found inside it. Hopefully `JetBrains` will fix it overtime


Please sign in to leave a comment.