Page 1 of 1

Search & Replace Task - Search for multiple rows

Posted: Mon Mar 23, 2009 10:47 am
by Support_Duane
The Search and Replace task is able to read multiple lines in the input file at a time. It is designed to read chunks of data and not line by line. In order to span multiple lines, use the special characters such as:
\r - Carriage Return
\n - Line Feed

Let's say you have an XML file and you want to search for a block of text like in the example below.
Code: Select all
<OTHER_DIAG_CODE>
    <DIAG_CODE></DIAG_CODE>
    <PRESENT_ON_ADMIT></PRESENT_ON_ADMIT>
</OTHER_DIAG_CODE>
You should enter the following value into the Search For attribute in the Search and Replace task:
Code: Select all
<OTHER_DIAG_CODE>\r\n  <DIAG_CODE></DIAG_CODE>\r\n  <PRESENT_ON_ADMIT></PRESENT_ON_ADMIT>\r\n</OTHER_DIAG_CODE>
Note: The end of line characters may be different on different systems (they may be just line feeds '\n' instead of carriage return-line feeds '\r\n') and the file may contain tabs instead of spaces. This example uses spaces, but the special tab character '\t' may be used instead. It all depends on how the file is formatted.