Tagged: regular expression
- August 28, 2018 at 7:37 am #23633DavidParticipant
Hello, Anyone knows how to match multi-line via Regular Expression?
There are some similar format files. some lines are fixed (same contents). I would like to search and add something inside.
`1000 function main takes nothing returns nothing</strong>
1001 call SetMapMusic(“Music”, true, 0)
1002 call CreateAllItems()
1003 call CreateAllUnits()
1004 call InitBlizzard()
1100 set udg_str=”” // INLINED!!
1101 call InitCustomTriggers()
The start row “function main takes nothing returns nothing” and end “endfunction” are fixed contents. But the row number and the gap between these two rows are unfixed. Since the row “endfuntion” is possible to exist alone. Then I have to consider start row and end row. But I don’t know how to match unfixed multi-row. Could you give me some hints.? Thank you!August 28, 2018 at 9:12 am #23634Mr KTParticipant
Assuming you are running a recent version of EmEditor, try:
Replace dialog box:
Tick “Use Regular Expressions”
(?:function main takes nothing returns nothing)(.*?)(?:endfunction)
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?)August 29, 2018 at 8:17 am #23636DavidParticipant
Mr KT. It works very well. A lot Thanks!
- You must be logged in to reply to this topic.