insert and replace test

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
bensonuser
Posts: 10
Joined: Wed Mar 12, 2008 2:33 pm

insert and replace test

Post by bensonuser »

i have a file which looks like this:
1 19166100
2 19179581
3 FW127


i need to replace <character><space><space>
with <zero><zero><character> where the character can be any number
between one and 9. i know how to replace the blanks with zeros but i can't figure out how to keep the character without replacing each group
one at a time.
User avatar
Bob Hansen
Posts: 1517
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Based on your description, this sounds doable. But, I am finding your explanation confusing.

Could you provide a better example of Before and After strings? Use real examples vs. <character> and <zero>. It would be useful to use another char to represent the <space> so the count of spaces can be seen.
Hope this was helpful.............good luck,
Bob
bensonuser
Posts: 10
Joined: Wed Mar 12, 2008 2:33 pm

Post by bensonuser »

1,,19166100
2,,19179581
3,,fw127

the , represents a space.

the end result would look like this:

00119166100
00219179581
003fw127

hope this makes everything a bit more clear. sorry for the confusion.

thanks for the quick response
User avatar
Bob Hansen
Posts: 1517
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

This works for one or more leading digits:

Search for: ^([0-9]+),,
Replace with: 00\1

Per your example, using comma "," for spaces.

Use the following settings:
-----------------------------------------
[X] Regular expression
Replace All
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------
Hope this was helpful.............good luck,
Bob
bensonuser
Posts: 10
Joined: Wed Mar 12, 2008 2:33 pm

thanks for the solution

Post by bensonuser »

thanks very much.

works like a charm.

you guys are great!
Post Reply