Find and replace

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
gajay
Posts: 3
Joined: Fri Dec 05, 2003 4:10 pm

Find and replace

Post by gajay »

Hello,
I have a text file which has a column containing data like 0.0000, 3.7800, 67.0900, etc. I want to remove the trailing two zeros. How can I do this?

Thanks.
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

Using POSIX regular expression:
find ([0-9]+.[0-9]{2})[0-9]{2}
replace \1
HTH

edit: it would be safer to limit the search to the right of the decimal
comma, ie. if there is a space (_) there in your file you would use it like:
find ([0-9]+.[0-9]{2})[0-9]{2}_ and replace \1_
Then I open up and see
the person fumbling here is me
a different way to be
gajay
Posts: 3
Joined: Fri Dec 05, 2003 4:10 pm

Post by gajay »

s_reynisson wrote:Using POSIX regular expression:
find ([0-9]+.[0-9]{2})[0-9]{2}
replace \1
HTH

edit: it would be safer to limit the search to the right of the decimal
comma, ie. if there is a space (_) there in your file you would use it like:
find ([0-9]+.[0-9]{2})[0-9]{2}_ and replace \1_
Thanks for your help but it did not work. I am able to find the text with \.[0-9][0-9]00 but don't know how to remove the last two zeros.
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

Sorry for not being clear on this, goto Configure->Preferences->Editor
and tick the "Use POSIX regular expression syntax" box.
In the replace dialog tick the "Regular expression" box.
s_reynisson wrote:Using POSIX regular expression
Then I open up and see
the person fumbling here is me
a different way to be
gajay
Posts: 3
Joined: Fri Dec 05, 2003 4:10 pm

Post by gajay »

Worked like a breeze. Thanks a bunch.
Post Reply