Find and replace with a delete.

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
tmendoza
Posts: 2
Joined: Mon Jan 28, 2008 5:09 pm

Find and replace with a delete.

Post by tmendoza »

I am not familiar with using Text pad's regular expressions, but I figure there must be a way to do this. I have a section of a line I want to remove--but the numbers at the end will not always be the same. Example:

NM1*72*1*RODRIGUEZ-BAEZ*NORBERTO****34*596054574~

I want to delete the **34*#########~ (The # represents 9 numbers)

Replace it with ~

But, since the numbers are different after the *34*--I am not sure how to do this. Can anyone help me?

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

Post by ben_josephs »

Find what: \*\*34\*[0-9]{9}~
Replace with: ~

[X] Regular expression
This assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
If the text you want to delete is always at the end of the line, you may want to put a $ at the end of the regular expression:
Find what: \*\*34\*[0-9]{9}~$
Replace with: ~

[X] Regular expression
tmendoza
Posts: 2
Joined: Mon Jan 28, 2008 5:09 pm

THANK YOU!

Post by tmendoza »

This is the first time I have used a community forum like this and I have not used expressions in Text Pad before. I am grateful for such a quick response and maybe I can help someone else in the future! :D
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Welcome. I'm glad I could help.
Post Reply