Community
    • Login

    Regular search between symbol.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Victor FatalV
      Victor Fatal
      last edited by

      I have many files with content:

      ClientAnimationController
      {
      skeleton = “Models”
      }

      SkinMesh
      {
      skin = “Effects”
      }

      SoundEvents
      {
      soundbank = “Effects.wav”
      }

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

      1 Reply Last reply Reply Quote 0
      • guy038G
        guy038
        last edited by guy038

        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

        1 Reply Last reply Reply Quote 1
        • Victor FatalV
          Victor Fatal
          last edited by

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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors