Need help splitting lines using reg ex in textpad

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
friskydingo
Posts: 2
Joined: Thu Jul 31, 2008 4:27 pm

Need help splitting lines using reg ex in textpad

Post by friskydingo »

Hi, if this solution is already out here in the forum I apologize in advance, I have been searching for a few days without any success.

I have a cvs file full of records that need to split into a different format


Example

A,B,D,1234
V,S,A,5432

Needs to be in the following format

A
B
D
1234

V
S
A
5432

** Note **
In a nutshell I need to create a four line record, with a blank line between each record
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

There are several, similar, ways to do this. For example
Find what: ^(.*),(.*),(.*),(.*)$
Replace with: \1\n\2\n\3\n\4\n

[X] Regular expression

Replace All
or (possibly faster)
Find what: ^([^,]*),([^,]*),([^,]*),([^,]*)$
Replace with: \1\n\2\n\3\n\4\n

[X] Regular expression

Replace All
These assume you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
friskydingo
Posts: 2
Joined: Thu Jul 31, 2008 4:27 pm

Post by friskydingo »

Thanks that was the fix that I needed, the solution seems all so clear to me now. Thanks again for helping me out.
Post Reply