Page 1 of 1

Replacing Characters with [Return}s

Posted: Tue Feb 27, 2007 12:17 am
by CWBillow
How can I replace a typed character (^) with an actual hard carriage return?

Regards,
Chuck Billow

Posted: Tue Feb 27, 2007 1:21 am
by Bob Hansen
Hello Chuck, try this:

Search for: \^
Replace with: \n

Checkmark for Regular Expression, using POSIX syntax

Posted: Tue Feb 27, 2007 1:30 am
by CWBillow
Bob Hansen wrote:Hello Chuck, try this:

Search for: \^
Replace with: \n

Checkmark for Regular Expression, using POSIX syntax
Bob:

Worked *exactly* as desired.... But I'm unclear as to the "using POSIX syntax" as I didn't see any choice of that in the query box.

Regards,
Chuck Billow

Posted: Tue Feb 27, 2007 9:09 am
by ben_josephs
It's hidden under configuration settings:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
In fact, it doesn't make any difference with this particular regular expression (\^), as it doesn't use any of:
( ) { } |

Look in TextPad's help, under How To... | Find and Replace Text | Use Regular Expressions. Posix syntax often leads to more readable regular expressions.

Posted: Tue Feb 27, 2007 10:13 am
by CWBillow
thanks...



Chuck

Posted: Tue Feb 27, 2007 2:46 pm
by Rediranch
I thought this is what I needed as well, but it's not working the way I expected it.

I have a file someone gave me (uncooperative someone) and it's record length is 1MB. It's full of sql insert statements, but not in the format that I need in order to process in my db.

I used textpad to format the lines into the statements I need, however, I need to do a global replacement of a character - ; with a ;<nl> in order to break these huge lines into multiple lines.

Basically I need to have the program do the equivalent of me hitting the RETURN key right after each ; encountered.

I must be missing something on the file format or encoding when I save this file after attempting to replace ; with ;\n .

Any help is appreciated.

Posted: Tue Feb 27, 2007 3:22 pm
by ben_josephs
You haven't told us in what way this appears not to be working.

Did you select Regular expression in the Replace dialogue box?

Posted: Tue Feb 27, 2007 4:08 pm
by Rediranch
That would be why - b/c I didnt read thoroughly enough :(

It's working now that I checked Regular Expression, thank you. :D