Find and replace across multiple rows
-
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.
-
@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.
-
That worked like a charm. Saved me hours worth of work. Thanks so much, I REALLY appreciate it.