Community
    • Login

    Problem with the search and replace function

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.2k 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.
    • Wolf KürschnerW
      Wolf Kürschner
      last edited by

      Hi,

      I just have installed Notepad++ and it works well for some search and replace work. I have a folder with hundreds of sub folders, with about 4000 html files. What I want to do is: delete all of the html in the files except for a small part (four lines - the files are 40kByte!).
      If I search for e.g. “<head>” and replace it with “” (nothing), this works well. But I’d like to delete larger parts of the files, e.g. the whole head section, that is: all between “<head>” and “</head>”. I tried it with <head>(.*?)</head> and a lot of other expressions found here in the forum, but none of them works?? What am I doing wrong??

      Truly yours,
      Wolf

      Scott SumnerS 1 Reply Last reply Reply Quote 0
      • Scott SumnerS
        Scott Sumner @Wolf Kürschner
        last edited by

        @Wolf-Kürschner

        It seems like you might need to span lines with your search? Maybe try:

        Find-what zone: (?s)<head>.*?</head>

        The (?s) part will allow the . part to match line-ending characters, thus allowing the matching to cross line boundaries.

        1 Reply Last reply Reply Quote 1
        • Wolf KürschnerW
          Wolf Kürschner
          last edited by

          YES!!

          Stupid me…

          Works well now!

          Thanks a lot!!
          :-) Wolf
          (By the way: Is there a help file somewhere? Beside foum and “Command LIne Arguments”?

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