Page 1 of 1

Deleting between two expressions

Posted: Mon Jan 02, 2012 3:14 pm
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,

Posted: Mon Jan 02, 2012 3:26 pm
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.

Posted: Tue Jan 03, 2012 12:00 pm
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.

Posted: Tue Jan 03, 2012 1:04 pm
by ben_josephs
That is an entirely different requirement.
Find what: #
Replace with: NEW TXT #