Community
    • Login

    How to search between multiple lines in Notepad++ ??

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 6.9k Views 1 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.
    • Prahlad-Makwana4145P Offline
      Prahlad-Makwana4145
      last edited by Prahlad-Makwana4145

      Hello, Everyone

      I am trying to perform a search between multiple lines and also delete selected text.
      Example show below :-

      I want to start a search from this word “Description This:” To “<h3>” select all text and delete it.
      When i search in 1st line i have used .*?.*

      Description This: 
                      Hello everyone.
                      How are you ?
                      Where are you ?
                      I am going to School please come with me.
                      Thank you for everything.
                      <h3>
                      Good to see you.
      

      Thank you in advance.

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

        Hello, Prahlad-Makwana4145 and All,

        Hi, Happy New Year 2020 !


        Regarding your problem, two solutions are possible :

        • SEARCH (?-i)^Description(?s).*?<h3>\R

        OR

        • SEARCH (?-i)^Description(.|\R)*?<h3>\R

        • REPLACE Leave EMPTY

        • Tick the Wrap around option and select the Regular expression search mode

        • Use either the Replace All or the Replace button

        Notes :

        • First, the in-line modifier (?-i) forces the search to care about casing of letters

        • After the part ^Description looks for the word Description, with that exact case, at beginning of lines

        • Then the part (?s), an in-line modifier too, means that any subsequent regex . symbol will match any single character, including EOL ones

        • Now, the part .*? represents the shortest range of any character till…

        • The part <h3>\R which matches an <h3> tag with its ine-break ( \R)

        • As replacement is empty, any text matched is just deleted

        • In the second search form, we replace the part (?s). with (.|\R) which stands, in the same way, for a single standard or an EOL character

        Best Regards,

        guy038

        Prahlad-Makwana4145P 1 Reply Last reply Reply Quote 2
        • Prahlad-Makwana4145P Offline
          Prahlad-Makwana4145 @guy038
          last edited by

          Hello, Happy New Year 2020 ! @guy038 and All,

          Thank you for Replay your both solution are work successfully for me.

          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