Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #23633

    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!

    Mr KT

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

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

    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!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.