Is this possible in TextPad?

General questions about using TextPad

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

Post Reply
BBowers
Posts: 17
Joined: Fri Jan 05, 2007 4:19 pm
Location: Colorado

Is this possible in TextPad?

Post by BBowers »

Ames, TX
710 East Main Street
Cedar Grove Park
Anahuac, TX
1512 South Main Street
Trinity Bay
Anna, TX
Hwy. 75 Exit 48
715 South Central Expressway
Love's - Travel Stops

Can I have TextPad search for each of the lines with ,TX but then back up to the beginning of the City ahead of the ,TX and place a \n so it will add a
blank line at that point, and look like the following?

Ames, TX
710 East Main Street
Cedar Grove Park

Anahuac, TX
1512 South Main Street
Trinity Bay

Anna, TX
Hwy. 75 Exit 48
715 South Central Expressway
Love's - Travel Stops
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

Yes, it is possible:

Find what: .*,?TX$
Replace with: \n&

Ensure the Regular expression check box is selected.

This assumes you are using POSIX regular expression syntax under Configure -> Preferences -> Editor.

Andrew
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Yes, that works.

Note that .*,? (any sequence of characters, possibly followed by a comma) is exactly equivalent to .* (any sequence of characters). For the OP's examples
.*, TX$
(with a space after the comma) is a good regex.
BBowers
Posts: 17
Joined: Fri Jan 05, 2007 4:19 pm
Location: Colorado

Post by BBowers »

Thanks, but when I tried your expression it didn't work. I did however drop the $ behind the TX, so:

Find what: .*,?TX did work.

What does the $ supposedly do?
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

It anchors the end of the match to the end of the line. Presumably there is white space at the ends of your lines.

Note my remark above, that the ,? after the .* is redundant.
Post Reply