Menu

Find and replace (insert Return character)

2008-02-06
2012-11-13
  • Atreyu Falcor

    Atreyu Falcor - 2008-02-06

    I have a whole lot of entries listed as:
      <image><filename>
    and would like to search and replace so the end result is so:
      <image>
      <filename>
    i.e. there is a return/enter after <image>

    I highlighted text on two lines and when I tried Search and Replace (Ctrl+H), I get the "square" which represents Return/Enter in the search box but I cannot copy it to the replace box. Anyone know how I can "type" the return character in a text editor?
    Thanks.

     
    • Nobody/Anonymous

      Read some more about this in similar messages about end-of-line / newline characters on this and other fora. Enter end-of-line or newline or CR+LF in the Search edit box on top of this page.

       
    • Nobody/Anonymous

      Use replace and select regular expressions. In the find area, type

      (<image>)(<filename>)  -- essentially, take your search text and break it into two groups

      In the replace area, type

      \1\r\n\2   -- \1 is the first group, \r\n is a carriage return and a new line, \2 is the second group.

      Click Replace All

      If you don't know regular expressions, this won't make any sense, but I tested it in np++...

      -Cordially, Steve

       
      • Atreyu Falcor

        Atreyu Falcor - 2008-02-06

        Thanks very much everyone!

         
    • Nobody/Anonymous

      How do you distinct between the image and the filename?

      If you know, you simply have to enter both characteristics into the Fiend field of the advanced Find/Replace dialog (CTRL+R).

      Past the same contents into the Replace field. Put the cursor between the image description and the filename and press CTRL+M.

      When you replace all occurrences, each filename should be separated from its image description by a newline.

      If your lines look something like:
      "this is an image description",this is the filename.jpg

      then enter in the Find field:
      ",

      And in the Replace field:
      ",
      Move the cursor in-between the " and , and press CTRL+M.