Find and replace failure with last character in a line

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
domingo_g
Posts: 2
Joined: Wed Aug 17, 2011 7:03 pm

Find and replace failure with last character in a line

Post by domingo_g »

All,

I am currently trying to find and replace a simple string shown below. I have the output I want but it still keeps the remaining "." postfixed to the string. How do I get rid of the "."?

Sample of data needing to be parsed.

SMSMO {17145886753} count is 1275.
SMSMO {15404296581} count is 722.
SMSMO {12405281615} count is 715.
SMSMO {14436165479} count is 565.
SMSMO {13128233172} count is 307.
SMSMO {18184453161} count is 159.

My regex:
find what=.*([0-9]{11}).*([:digit:]).
replace with=\1\t

Sample of output after find/replace is executed.

17145886753 1275.
15404296581 722.
12405281615 715.
14436165479 565.
13128233172 307.
18184453161 159.

Above is perfect for what I need since I can paste this into excel with the tab which places the separated values into their own columns but as you can see I still have a "." at the end of each line.

Can anyone help me get rid of it as I have exhausted my attempts at different regexs to do so.

Also, I know I can jsut do a simple find and replace for the dot without regex usage but I was wondering if there was a way to do a one liner to clean up the output with one execution.

Thanks in advance
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

Here's a simple way to do it:

Find what: SMSMO {(.*)} count is (.*)\.
Replace with: \1\t\2

But if you want to fix the regular expression you were using:

Find what: .*([0-9]{11})[^0-9]*([0-9]*)\.
Replace with: \1\t\2
domingo_g
Posts: 2
Joined: Wed Aug 17, 2011 7:03 pm

Post by domingo_g »

Thanks, ak47!

I highly appreciate it.
Post Reply