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:
- Standard find dialog at menu Search / Find
- Search again (for the next match after the cursor position) using the last pattern in the above dialog at menu Search / Find again
- Regular expression search / replace at menu Search / Advanced Search & Replace
- Regular expression search / replace in the project at menu Project / Search & Replace
- Regular expression search / replace in the File Explorer that can search in selected files or folders by pressing the "Find" button.
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")