Page 1 of 1

how to work backwards?

Posted: Mon Feb 19, 2007 5:15 pm
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)

Posted: Mon Feb 19, 2007 5:25 pm
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