'Search and comment all matches

Is there a way to comment all the matches when doing CTRL+F or CTRL+R?

I have tried a quick fix, but this is not working properly when the line to be printed is in different lines:

enter image description here

# print("Hello"
        "World")

I am using Python 3.7 and PyCharm 2021.3.1



Solution 1:[1]

I guess you want select the print function and comment the all of the print function with "Hello World" part. You can do step by step;

  1. Click CTRL+F and after then click regex button
  2. Write what you want with regex( In this question you should write ^print\(.*(\n*.*)*\)$). When you do that, you already select the whole line
  3. If you want to make comment all of the print function you can click Select All Occurences.
  4. Then you can make comment with your multiline comment shortcute

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1