Find/Replace multiple lines
-
Using Search/Replace I can find “GRID=” in the following text:
1 EVEN
2 TYPE FindaGrave
2 NOTE GRID= somenumberI’d like the replacement to read:
1 EVEN
2 TYPE R
2 ADDR somenumber
2 NOTE GRID=somenumberI need to be able store “somenumber” and use that number (it changes) to create the replacement example multiple times in the text file (it’s a GEDcom file). Can this be done in one pass?
-
@Dave-C-1 said in Find/Replace multiple lines:
Can this be done in one pass?
Using regular expression search, yes.
FIND =
2 NOTE GRID=(\d+)
REPLACE =2 ADDR $1\r\n$0
In the FIND, the
(\d+)
says "find one or more digits and put in group#1)
In the REPLACE, the$1
says “use the contents stored in group#1” and the$0
says “use the full matched text”----
Useful References