Regular search between symbol.



  • I have many files with content:

    ClientAnimationController
    {
    skeleton = “Models”
    }

    SkinMesh
    {
    skin = “Effects”
    }

    SoundEvents
    {
    soundbank = “Effects.wav”
    }

    I need to delete all content between:
    SkinMesh
    {
    *****
    }



  • Hello, @victor-fatal,

    Very easy with regular expressions, indeed !

    • To avoid bad surprises, backup, first, all the concerned files or, better, the concerned folder

    • Open the Find in Files dialog ( Ctrl + Shift + F )

    • In the Find what: zone type SkinMesh\R\{\R\K(?-s).+

    • Leave the Replace with zone EMPTY

    • Enter the names of all your files, or, probably a filter, in the Filters : zone

    • Enter the name of the directory, containing the files to scan for, in the Directory : zone

    • Click on the Replace in Files button

    • Confirm the Are you sure dialog, after checking

    • Et voilà ! It should have changed all lines skin = “…” into pure blank lines


    Notes :

    • The first part SkinMesh\R\{\R searches for the string SkinMesh, followed by End of Line character(s), then followed by an opening curly brace, and followed, again, by End of Line character(s)

    • Note that the { special symbol must be escaped, to be considered as a literal

    • Now, the part \K just resets the regex search position of the regex engine

    • Then, the (?-s) modifier forces the regex engine to consider the dot as matching standard characters, only ( not End of Line characters ! )

    • Finally, the part .+ represents all the standard characters of the next line, that is to say the string skin = "…"

    Remark : If you prefer to wipe out all lines of this type, just add an \R syntax, at the end of the search regex, in order to get :

    SkinMesh\R\{\R\K(?-s).+\R and leave EMPTY, as above, in the replacement zone

    Best Regards,

    guy038



  • It’s just wonderful, thanks for the detailed response. Thank you very much!


Log in to reply