#23634
Mr KT
Participant

Assuming you are running a recent version of EmEditor, try:
Replace dialog box:
Tick “Use Regular Expressions”

Find:
(?:function main takes nothing returns nothing)(.*?)(?:endfunction)
Replace with:
something

Select the Advanced button:
Tick “Regular Expression “.” Can Match Newline Character”
Set the Additional Lines to Search for Regular Expressions to whatever number you need to match the largest block you want to replace (999?)