Deleting between two expressions

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

Deleting between two expressions

Post by BBowers »

- American Canyon #1651,
- Anaheim #2242,
- Anderson #5133,
- Antelope #1881,
- Bakersfield #1574,
- Bakersfield #5134,
- Baldwin Park #3522,
- Beaumont #5156,
- Brawley #5335,

I have the above text in a file. I want to search for anything that's between the hyphen '-' and the pound sign '#' and delete the text in between.

So it will look like.
- #1651,
- #2242,
- #5133,
- #1881,
- #1574,
- #5134,
- #3522,
- #5156,
- #5335,
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

Perform a Replace as follows:

Find what: -_.*_# [replace the underscore with a space]
Replace with: -_# [replace the underscore with a space]

Select Regular expression and click Replace All.
BBowers
Posts: 17
Joined: Fri Jan 05, 2007 4:19 pm
Location: Colorado

Post by BBowers »

Thanks for the quick response. I'm still trying to learn about this stuff. I do have another question related to my first one.

What if I wanted to REPLACE, instead of DELETE the information?
Example:
- American Canyon NEW TXT #1651,
- Anaheim NEW TXT #2242,
- Anderson NEW TXT #5133,
- Antelope NEW TXT #1881,
- Bakersfield NEW TXT #1574,

This is another part I haven't quite mastered yet.
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

That is an entirely different requirement.
Find what: #
Replace with: NEW TXT #
Post Reply