Page 1 of 1

Is this possible in TextPad?

Posted: Mon Oct 19, 2009 11:15 pm
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

Posted: Tue Oct 20, 2009 3:03 am
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

Posted: Tue Oct 20, 2009 8:17 am
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.

Posted: Tue Oct 20, 2009 11:43 am
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?

Posted: Tue Oct 20, 2009 12:27 pm
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.