Community
    • Login

    Find and replace across multiple rows

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 359 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.
    • Ricardo GonzalezR
      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
        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
          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
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors