Community
    • Login

    Problem with the search and replace function

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.5k Views 2 Watching
    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 Offline
      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 Offline
        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 Offline
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors