Community
    • Login

    Find and replace across multiple rows

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 675 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.
    • Ricardo GonzalezR Offline
      Ricardo Gonzalez
      last edited by

      All, I’m extremely new to Notepad++. I’m working on a project for work and am faced with the following issue:

      Is there a way for me to combine the first two lines of each item?

      I want to convert:
      <RECORD>
      <RECORD-id>1</RECORD-id>

      To:
      <RECORD id=“1”>

      And have that apply to all my records in the file. Thanks so much in advance.

      76443c0e-32b1-4f33-90fa-97dd18a2d6dc-image.png

      CoisesC 1 Reply Last reply Reply Quote 0
      • CoisesC Offline
        Coises @Ricardo Gonzalez
        last edited by Coises

        @Ricardo-Gonzalez said in Find and replace across multiple rows:

        I want to convert:
        <RECORD>
        <RECORD-id>1</RECORD-id>

        To:
        <RECORD id=“1”>

        That’s a fairly simple job for regular expression search, so long as the format and order stays just as you’ve indicated.

        From the main menu, select Search | Replace… and fill in:

        Find what: ^\s*<RECORD>\s*\R\s*<RECORD-id>(\d+)</RECORD-id>\s*$

        Replace with: <RECORD id="$1">

        Be sure the radio button Regular expression is selected and use the Replace All button.

        Ricardo GonzalezR 1 Reply Last reply Reply Quote 4
        • Ricardo GonzalezR Offline
          Ricardo Gonzalez @Coises
          last edited by

          That worked like a charm. Saved me hours worth of work. Thanks so much, I REALLY appreciate it.

          1 Reply Last reply Reply Quote 3

          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