Replacing Characters with [Return}s

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
User avatar
CWBillow
Posts: 110
Joined: Thu Nov 06, 2003 11:59 pm
Location: Chula Vista California
Contact:

Replacing Characters with [Return}s

Post by CWBillow »

How can I replace a typed character (^) with an actual hard carriage return?

Regards,
Chuck Billow
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Hello Chuck, try this:

Search for: \^
Replace with: \n

Checkmark for Regular Expression, using POSIX syntax
Hope this was helpful.............good luck,
Bob
User avatar
CWBillow
Posts: 110
Joined: Thu Nov 06, 2003 11:59 pm
Location: Chula Vista California
Contact:

Post 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
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post 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.
User avatar
CWBillow
Posts: 110
Joined: Thu Nov 06, 2003 11:59 pm
Location: Chula Vista California
Contact:

Post by CWBillow »

thanks...



Chuck
Rediranch
Posts: 7
Joined: Tue May 17, 2005 2:03 pm

Post 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.
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post 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?
Rediranch
Posts: 7
Joined: Tue May 17, 2005 2:03 pm

Post 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
Post Reply