how to work backwards?

General questions about using TextPad

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

Post Reply
martib
Posts: 19
Joined: Wed Aug 23, 2006 2:28 pm

how to work backwards?

Post by martib »

hi,

i have different lines like

here and there some text 4598
45 eref ereo and more more

i want to replace the last space with |
so the output should be

here and there some text|4598
45 eref ereo and more|more

(and later maybe the second last space)
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

To replace the last space with |:
Find what: (.*)-([^-]+)$ [Replace the hyphens with spaces]
Replace with: \1|\2

[X] Regular expression
To replace the second last space with |:
Find what: (.*)-([^-]+-[^-]+)$ [Replace the hyphens with spaces]
Replace with: \1|\2

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

[X] Use POSIX regular expression syntax
Post Reply