Author Topic: Find and Replace - 'new line' character  (Read 3480 times)

Offline EK_Konrad

  • Newcomer
  • *
  • Posts: 9
    • View Profile
Find and Replace - 'new line' character
« on: July 31, 2006, 04:10:14 AM »
Hi,

is it possible to find and replace the 'new line' (CR or LF) character, e.g. in captions?

best
Konrad

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Find and Replace - 'new line' character
« Reply #1 on: July 31, 2006, 04:18:53 AM »
Konrad,

is it possible to find and replace the 'new line' (CR or LF) character, e.g. in captions?

Probably, but you'll have to copy it from a text editor, and paste it in.  Give that a try.

HTH,

-Kirk

Offline devenh

  • Sr. Member
  • ****
  • Posts: 435
    • View Profile
Re: Find and Replace - 'new line' character
« Reply #2 on: June 28, 2007, 11:58:41 AM »
Kirk,

I don't think pasting a CR/LF chararcter sequence will work since these are hidden characters -- hidden in the sense that an editor does not display them, but rather causes an editor to display a new line.

I checked whether the Windows Character Map application would allow me to copy these characters, and it does not.

Most editors that support searching and replacing special characters use an escape code of some sort.

For instance, if I wanted to change a caption containing:

George Washington John Adams

to:

George Washington
John Adams

I would do something like:

Search: Washington John
Replace: Washington\013\010John

Where the application would identify anything in the form of \nnn as an escape code and replace it with an ASCII character.

This would be a nice feature to have!

Deven

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Find and Replace - 'new line' character
« Reply #3 on: June 28, 2007, 12:10:20 PM »
Deven,

I don't think pasting a CR/LF chararcter sequence will work since these are hidden characters -- hidden in the sense that an editor does not display them, but rather causes an editor to display a new line.

That's not true.  When you copy a selection of text that includes line breaks, the actual CR and LF characters get copied to the clipboard.  Those bytes are actually in the clipboard buffer.  When you paste that clipboard to another document the editor interprets those bytes and draws the lines broke as you would expect.

What the original poster had asked for should be solved by my suggestion.

-Kirk

Offline devenh

  • Sr. Member
  • ****
  • Posts: 435
    • View Profile
Re: Find and Replace - 'new line' character
« Reply #4 on: June 28, 2007, 02:44:13 PM »
Maybe I am doing something wrong  :)

Using my previous example where I want to put our first and second presidents on seperate lines, I tried copying the following text by selecting the two lines, pressing Ctrl+C, and then pasting the result using Ctrl+V into the "Replace with" edit box in the "Find and Replace in IPTC Fields" dialog box.

George Washington
John Adams

When I do that, the "Replace with" edit box only contains

George Washington

and John Adams appears to get truncated.  When I try to perform the replacement, it changes

George Washington John Adams

to

George Washington

I am running under Windows.

Deven