Question of Regular Expression for matching multi-row

Started by: David2 voices3 posts

Tagged: regular expression

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. Example : `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() 1102 endfunction` 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!
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?)
Mr KT. It works very well. A lot Thanks!

3 posts in this topic