Introduction and examples - hakakou/optiperl GitHub Wiki

Optiperl takes searching and replacing very seriously. It has many powerful tools to search and / or replace text in your project or entire folders, with or without prompting. Pattern-Search Optiperl has the following tools to search and replace:

Examples using Regular expression search / replace

Adding a comment before each subroutine containing the subroutines name and normalizing the spacing between subroutines.

Find: }[\n\s\t]+sub +(\w+)

Replace: }\n\n#####\n# Subroutine: \1\n#####\nsub \1

After changing what a heavily used subroutine parameters should be, you need to add the parameter "1" on all the instances of calling the subroutine (the subroutine is called "mysub"):

Find: ([\s\t]*mysub\s*\([^)]+)\)

Replace: \1,"1")