Find and Replace Question

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
mrredpants
Posts: 2
Joined: Wed Nov 14, 2007 6:35 pm

Find and Replace Question

Post by mrredpants »

I have a csv file I'm trying to edit in text pad...it has many lines that are similar to this:

faxnumber,firstname,lastname
18139887605,Bill Kyser,Bill Kyser
18139950930,Linda Register,Linda Register

What I would like is to do is this:

faxnumber,firstname,lastname
18139887605,=LEFT("Bill Kyser",20),Bill Kyser
18139950930,=LEFT("Linda Register",20),Linda Register

I just can't figure out how to step by step do something like this, i.e. how to select text, tell textad to find and replace by inserting the =LEFT, etc.

Thanks in advance.
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Use a regular expression search and replace:
Find what: ^([0-9]+,)([^,]+)
Replace with: \1=LEFT("\2",20)

[X] Regular expression

Replace All
This assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Look in TextPad's help under
Reference Information | Regular Expressions and
How to... | Find and Replace Text | Use Regular Expressions.
mrredpants
Posts: 2
Joined: Wed Nov 14, 2007 6:35 pm

Post by mrredpants »

you are a gentleman and a scholar
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

At most one of those.
Post Reply