Forum Discussion

subbu_valliappa's avatar
subbu_valliappa
Contributor
9 years ago

Search and Replace to include multiple lines (using DelphiScript)

I have these two lines in a text file:   string1 string2   I want to find these two lines and replace with a single line:   string3   The scripts that I have is as follows:   //Create a re...
  • joseph_michaud's avatar
    joseph_michaud
    9 years ago

    The file contains only newlines (and no carriage returns).  Change your search expression to either of the following

     

    runlogRegEx.Expression := 'string1'+#10+'string2';
    ...
    runlogRegEx.Expression := 'string1\nstring2';

     

    The regular expression syntax used by HISUtils.RegExpr is more completely described here:

     

    Tokens Used in Native Regular Expressions